SphinxResult.java 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * $Id$
  3. */
  4. package org.sphx.api;
  5. /**
  6. * Search result set.
  7. *
  8. * Includes retrieved matches array, status code and error/warning messages,
  9. * query stats, and per-word stats.
  10. */
  11. public class SphinxResult
  12. {
  13. /** Full-text field namess. */
  14. public String[] fields;
  15. /** Attribute names. */
  16. public String[] attrNames;
  17. /** Attribute types (refer to SPH_ATTR_xxx constants in SphinxClient). */
  18. public int[] attrTypes;
  19. /** Retrieved matches. */
  20. public SphinxMatch[] matches;
  21. /** Total matches in this result set. */
  22. public int total;
  23. /** Total matches found in the index(es). */
  24. public int totalFound;
  25. /** Elapsed time (as reported by searchd), in seconds. */
  26. public float time;
  27. /** Per-word statistics. */
  28. public SphinxWordInfo[] words;
  29. /** Warning message, if any. */
  30. public String warning = null;
  31. /** Error message, if any. */
  32. public String error = null;
  33. /** Query status (refer to SEARCHD_xxx constants in SphinxClient). */
  34. private int status = -1;
  35. /** Trivial constructor, initializes an empty result set. */
  36. public SphinxResult()
  37. {
  38. this.attrNames = new String[0];
  39. this.matches = new SphinxMatch[0];;
  40. this.words = new SphinxWordInfo[0];
  41. this.fields = new String[0];
  42. this.attrTypes = new int[0];
  43. }
  44. /** Get query status. */
  45. public int getStatus()
  46. {
  47. return status;
  48. }
  49. /** Set query status (accessible from API package only). */
  50. void setStatus ( int status )
  51. {
  52. this.status = status;
  53. }
  54. }
  55. /*
  56. * $Id$
  57. */