Browse files

Imported Upstream version 0.9.8.1

  • Loading branch information...
0 parents commit 1ae8569f6742c19f9cad1b012436f08405a56249 @johnl committed Dec 9, 2008
Showing with 44,719 additions and 0 deletions.
  1. +344 −0 COPYING
  2. +1 −0 INSTALL
  3. +11 −0 Makefile.am
  4. +625 −0 Makefile.in
  5. +289 −0 acinclude.m4
  6. +2 −0 api/java/MANIFEST.MF
  7. +33 −0 api/java/Makefile
  8. +26 −0 api/java/README
  9. +1,126 −0 api/java/SphinxClient.java
  10. +24 −0 api/java/SphinxException.java
  11. +35 −0 api/java/SphinxMatch.java
  12. +75 −0 api/java/SphinxResult.java
  13. +30 −0 api/java/SphinxWordInfo.java
  14. +3 −0 api/java/mk.cmd
  15. +1 −0 api/java/mkdoc.cmd
  16. +159 −0 api/java/test.java
  17. +481 −0 api/libsphinxclient/COPYING
  18. +13 −0 api/libsphinxclient/Makefile.am
  19. +616 −0 api/libsphinxclient/Makefile.in
  20. +51 −0 api/libsphinxclient/README
  21. +37 −0 api/libsphinxclient/build.mk
  22. +38 −0 api/libsphinxclient/buildconf.sh
  23. +1,411 −0 api/libsphinxclient/config.guess
  24. +1,500 −0 api/libsphinxclient/config.sub
  25. +20,207 −0 api/libsphinxclient/configure
  26. +75 −0 api/libsphinxclient/configure.in
  27. +322 −0 api/libsphinxclient/install-sh
  28. +174 −0 api/libsphinxclient/libsphinxclient.vcproj
  29. +6,425 −0 api/libsphinxclient/ltmain.sh
  30. +353 −0 api/libsphinxclient/missing
  31. +1,903 −0 api/libsphinxclient/sphinxclient.c
  32. +221 −0 api/libsphinxclient/sphinxclient.h
  33. +55 −0 api/libsphinxclient/sphinxclient_config.h.in
  34. +205 −0 api/libsphinxclient/test.c
  35. +28 −0 api/libsphinxclient/test.sln
  36. +192 −0 api/libsphinxclient/test.vcproj
  37. +38 −0 api/ruby/README.rdoc
  38. +21 −0 api/ruby/Rakefile
  39. +1 −0 api/ruby/init.rb
  40. +5 −0 api/ruby/install.rb
  41. +6 −0 api/ruby/lib/sphinx.rb
  42. +1,020 −0 api/ruby/lib/sphinx/client.rb
  43. +44 −0 api/ruby/lib/sphinx/request.rb
  44. +69 −0 api/ruby/lib/sphinx/response.rb
  45. +103 −0 api/ruby/spec/client_response_spec.rb
  46. +546 −0 api/ruby/spec/client_spec.rb
  47. +8 −0 api/ruby/spec/fixtures/default_search.php
  48. +8 −0 api/ruby/spec/fixtures/default_search_index.php
  49. +11 −0 api/ruby/spec/fixtures/excerpt_custom.php
  50. +8 −0 api/ruby/spec/fixtures/excerpt_default.php
  51. +11 −0 api/ruby/spec/fixtures/excerpt_flags.php
  52. +9 −0 api/ruby/spec/fixtures/field_weights.php
  53. +9 −0 api/ruby/spec/fixtures/filter.php
  54. +9 −0 api/ruby/spec/fixtures/filter_exclude.php
  55. +9 −0 api/ruby/spec/fixtures/filter_float_range.php
  56. +9 −0 api/ruby/spec/fixtures/filter_float_range_exclude.php
  57. +9 −0 api/ruby/spec/fixtures/filter_range.php
  58. +9 −0 api/ruby/spec/fixtures/filter_range_exclude.php
  59. +10 −0 api/ruby/spec/fixtures/filter_ranges.php
  60. +10 −0 api/ruby/spec/fixtures/filters.php
  61. +13 −0 api/ruby/spec/fixtures/filters_different.php
  62. +9 −0 api/ruby/spec/fixtures/geo_anchor.php
  63. +9 −0 api/ruby/spec/fixtures/group_by_attr.php
  64. +9 −0 api/ruby/spec/fixtures/group_by_attrpair.php
  65. +9 −0 api/ruby/spec/fixtures/group_by_day.php
  66. +9 −0 api/ruby/spec/fixtures/group_by_day_sort.php
  67. +9 −0 api/ruby/spec/fixtures/group_by_month.php
  68. +9 −0 api/ruby/spec/fixtures/group_by_week.php
  69. +9 −0 api/ruby/spec/fixtures/group_by_year.php
  70. +10 −0 api/ruby/spec/fixtures/group_distinct.php
  71. +9 −0 api/ruby/spec/fixtures/id_range.php
  72. +9 −0 api/ruby/spec/fixtures/id_range64.php
  73. +9 −0 api/ruby/spec/fixtures/index_weights.php
  74. +8 −0 api/ruby/spec/fixtures/keywords.php
  75. +9 −0 api/ruby/spec/fixtures/limits.php
  76. +9 −0 api/ruby/spec/fixtures/limits_cutoff.php
  77. +9 −0 api/ruby/spec/fixtures/limits_max.php
  78. +9 −0 api/ruby/spec/fixtures/limits_max_cutoff.php
  79. +9 −0 api/ruby/spec/fixtures/match_all.php
  80. +9 −0 api/ruby/spec/fixtures/match_any.php
  81. +9 −0 api/ruby/spec/fixtures/match_boolean.php
  82. +9 −0 api/ruby/spec/fixtures/match_extended.php
  83. +9 −0 api/ruby/spec/fixtures/match_extended2.php
  84. +9 −0 api/ruby/spec/fixtures/match_fullscan.php
  85. +9 −0 api/ruby/spec/fixtures/match_phrase.php
  86. +9 −0 api/ruby/spec/fixtures/max_query_time.php
  87. +12 −0 api/ruby/spec/fixtures/miltiple_queries.php
  88. +9 −0 api/ruby/spec/fixtures/ranking_bm25.php
  89. +9 −0 api/ruby/spec/fixtures/ranking_none.php
  90. +9 −0 api/ruby/spec/fixtures/ranking_proximity_bm25.php
  91. +9 −0 api/ruby/spec/fixtures/ranking_wordcount.php
  92. +9 −0 api/ruby/spec/fixtures/retries.php
  93. +9 −0 api/ruby/spec/fixtures/retries_delay.php
  94. +9 −0 api/ruby/spec/fixtures/sort_attr_asc.php
  95. +9 −0 api/ruby/spec/fixtures/sort_attr_desc.php
  96. +9 −0 api/ruby/spec/fixtures/sort_expr.php
  97. +9 −0 api/ruby/spec/fixtures/sort_extended.php
  98. +9 −0 api/ruby/spec/fixtures/sort_relevance.php
  99. +9 −0 api/ruby/spec/fixtures/sort_time_segments.php
  100. +1,181 −0 api/ruby/spec/fixtures/sphinxapi.php
  101. +8 −0 api/ruby/spec/fixtures/update_attributes.php
  102. +9 −0 api/ruby/spec/fixtures/weights.php
  103. +67 −0 api/ruby/spec/sphinx/sphinx.conf
  104. +86 −0 api/ruby/spec/sphinx/sphinx_test.sql
  105. +3 −0 api/ruby/sphinx.yml.tpl
  106. +75 −0 api/ruby/tasks/sphinx.rake
  107. +1,187 −0 api/sphinxapi.php
  108. +855 −0 api/sphinxapi.py
  109. +158 −0 api/test.php
  110. +124 −0 api/test.py
  111. +53 −0 api/test2.php
  112. +27 −0 api/test2.py
  113. +6 −0 bootstrap
  114. +236 −0 config/config.h.in
  115. +530 −0 config/depcomp
  116. +323 −0 config/install-sh
  117. +360 −0 config/missing
Sorry, we could not display the entire diff because it was too big.
344 COPYING
@@ -0,0 +1,344 @@
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
+
1 INSTALL
@@ -0,0 +1 @@
+Please refer to <<Installation>> section in doc/sphinx.txt or doc/sphinx.html.
11 Makefile.am
@@ -0,0 +1,11 @@
+if USE_LIBSTEMMER
+SUBDIRS = libstemmer_c src test
+else
+SUBDIRS = src test
+endif
+
+EXTRA_DIST = api storage sphinx.conf.in sphinx-min.conf.in example.sql
+sysconf_DATA = sphinx.conf.dist sphinx-min.conf.dist example.sql
+
+install-data-hook:
+ mkdir -p $(DESTDIR)$(localstatedir)/data && mkdir -p $(DESTDIR)$(localstatedir)/log
625 Makefile.in
@@ -0,0 +1,625 @@
+# Makefile.in generated by automake 1.9.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = .
+DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/sphinx-min.conf.in \
+ $(srcdir)/sphinx.conf.in $(top_srcdir)/config/config.h.in \
+ $(top_srcdir)/configure COPYING INSTALL config/depcomp \
+ config/install-sh config/missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config/config.h
+CONFIG_CLEAN_FILES = sphinx.conf.dist sphinx-min.conf.dist
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(sysconfdir)"
+sysconfDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(sysconf_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = src test libstemmer_c
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CONFDIR = @CONFDIR@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MYSQL_CFLAGS = @MYSQL_CFLAGS@
+MYSQL_LIBS = @MYSQL_LIBS@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PGSQL_CFLAGS = @PGSQL_CFLAGS@
+PGSQL_LIBS = @PGSQL_LIBS@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_LIBSTEMMER_FALSE = @USE_LIBSTEMMER_FALSE@
+USE_LIBSTEMMER_TRUE = @USE_LIBSTEMMER_TRUE@
+USE_MYSQL_FALSE = @USE_MYSQL_FALSE@
+USE_MYSQL_TRUE = @USE_MYSQL_TRUE@
+USE_PGSQL_FALSE = @USE_PGSQL_FALSE@
+USE_PGSQL_TRUE = @USE_PGSQL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pgconfig = @pgconfig@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+@USE_LIBSTEMMER_FALSE@SUBDIRS = src test
+@USE_LIBSTEMMER_TRUE@SUBDIRS = libstemmer_c src test
+EXTRA_DIST = api storage sphinx.conf.in sphinx-min.conf.in example.sql
+sysconf_DATA = sphinx.conf.dist sphinx-min.conf.dist example.sql
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config/config.h: config/stamp-h1
+ @if test ! -f $@; then \
+ rm -f config/stamp-h1; \
+ $(MAKE) config/stamp-h1; \
+ else :; fi
+
+config/stamp-h1: $(top_srcdir)/config/config.h.in $(top_builddir)/config.status
+ @rm -f config/stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config/config.h
+$(top_srcdir)/config/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f config/stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config/config.h config/stamp-h1
+sphinx.conf.dist: $(top_builddir)/config.status $(srcdir)/sphinx.conf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+sphinx-min.conf.dist: $(top_builddir)/config.status $(srcdir)/sphinx-min.conf.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+uninstall-info-am:
+install-sysconfDATA: $(sysconf_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)"
+ @list='$(sysconf_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
+ $(sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
+ done
+
+uninstall-sysconfDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sysconf_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \
+ done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/. $(distdir)/config
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(sysconfdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-exec-am: install-sysconfDATA
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-sysconfDATA
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-generic \
+ distclean-hdr distclean-recursive distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-data-hook install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ install-sysconfDATA installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am uninstall-sysconfDATA
+
+
+install-data-hook:
+ mkdir -p $(DESTDIR)$(localstatedir)/data && mkdir -p $(DESTDIR)$(localstatedir)/log
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
289 acinclude.m4
@@ -0,0 +1,289 @@
+dnl ---------------------------------------------------------------------------
+dnl Macro: AC_CHECK_MYSQL
+dnl Check for custom MySQL paths in --with-mysql-* options.
+dnl If some paths are missing, check if mysql_config exists.
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_CHECK_MYSQL],[
+
+mysqlconfig_locations="mysql_config /usr/bin/mysql_config /usr/local/bin/mysql_config /usr/local/mysql/bin/mysql_config /opt/mysql/bin/mysql_config /usr/pkg/bin/mysql_config"
+user_mysql_includes=
+user_mysql_libs=
+
+# check explicit MySQL root for mysql_config, include, lib
+if test [ x$1 != xyes -a x$1 != xno ]
+then
+ mysqlroot=`echo $1 | sed -e 's+/$++'`
+ if test [ -x "$mysqlroot/bin/mysql_config" ]
+ then
+ # if there's mysql_config, that's the best route
+ mysqlconfig_locations="$mysqlroot/bin/mysql_config"
+ elif test [ -d "$mysqlroot/include" -a -d "$mysqlroot/lib" ]
+ then
+ # explicit root; do not check well-known paths
+ mysqlconfig_locations=
+
+ # includes
+ if test [ -d "$mysqlroot/include/mysql" ]
+ then
+ user_mysql_includes="$mysqlroot/include/mysql"
+ else
+ user_mysql_includes="$mysqlroot/include"
+ fi
+
+ # libs
+ if test [ -d "$mysqlroot/lib/mysql" ]
+ then
+ user_mysql_libs="$mysqlroot/lib/mysql"
+ else
+ user_mysql_libs="$mysqlroot/lib"
+ fi
+ else
+ AC_MSG_ERROR([invalid MySQL root directory '$mysqlroot'; neither bin/mysql_config, nor include/ and lib/ were found there])
+ fi
+fi
+
+
+# try running mysql_config
+AC_MSG_CHECKING([for mysql_config])
+for mysqlconfig in $mysqlconfig_locations
+do
+ if test [ -n "$mysqlconfig" ]
+ then
+ MYSQL_CFLAGS=`${mysqlconfig} --cflags 2>/dev/null`
+ MYSQL_LIBS=`${mysqlconfig} --libs 2>/dev/null`
+
+ if test [ $? -eq 0 ]
+ then
+ AC_MSG_RESULT([$mysqlconfig])
+ mysqlconfig=
+ break
+ else
+ MYSQL_CFLAGS=
+ MYSQL_LIBS=
+ fi
+ fi
+done
+if test [ -n "$mysqlconfig" ]
+then
+ AC_MSG_RESULT([not found])
+fi
+
+
+# if there's nothing from mysql_config, check well-known include paths
+# explicit overrides will be applied later
+if test [ -z "$MYSQL_CFLAGS" ]
+then
+ for CANDIDATE in "$user_mysql_includes" "/usr/local/mysql/include" "/usr/local/mysql/include/mysql" \
+ "/usr/include/mysql"
+ do
+ if test [ -n "$CANDIDATE" -a -r "$CANDIDATE/mysql.h" ]
+ then
+ MYSQL_CFLAGS="-I$CANDIDATE"
+ break
+ fi
+ done
+fi
+
+
+# if there's nothing from mysql_config, check well-known library paths
+# explicit overrides will be applied later
+if test [ -z "$MYSQL_LIBS" ]
+then
+ for CANDIDATE in "$user_mysql_libs" "/usr/lib64/mysql" \
+ "/usr/local/mysql/lib/mysql" "/usr/local/mysql/lib" \
+ "/usr/local/lib/mysql" "/usr/lib/mysql" \
+ "/opt/mysql/lib/mysql" "/usr/pkg/lib/mysql"
+ do
+ if test [ -n "$CANDIDATE" -a -d "$CANDIDATE" ]
+ then
+ MYSQL_LIBS="-L$CANDIDATE -lmysqlclient -lz"
+ break
+ fi
+ done
+fi
+
+
+# apply explicit include path overrides
+AC_ARG_WITH([mysql-includes],
+ AC_HELP_STRING([--with-mysql-includes], [path to MySQL header files]),
+ [ac_cv_mysql_includes=$withval])
+if test [ -n "$ac_cv_mysql_includes" ]
+then
+ MYSQL_CFLAGS="-I$ac_cv_mysql_includes"
+fi
+
+
+# apply explicit lib path overrides
+AC_ARG_WITH([mysql-libs],
+ AC_HELP_STRING([--with-mysql-libs], [path to MySQL libraries]),
+ [ac_cv_mysql_libs=$withval])
+if test [ -n "$ac_cv_mysql_libs" ]
+then
+ # Trim trailing '.libs' if user passed it in --with-mysql-libs option
+ ac_cv_mysql_libs=`echo ${ac_cv_mysql_libs} | sed -e 's/.libs$//' \
+ -e 's+.libs/$++'`
+ MYSQL_LIBS="-L$ac_cv_mysql_libs -lmysqlclient -lz"
+fi
+
+
+# now that we did all we could, perform final checks
+AC_MSG_CHECKING([MySQL include files])
+if test [ -z "$MYSQL_CFLAGS" ]
+then
+ AC_MSG_ERROR([missing include files.
+
+******************************************************************************
+ERROR: cannot find MySQL include files.
+
+Check that you do have MySQL include files installed.
+The package name is typically 'mysql-devel'.
+
+If include files are installed on your system, but you are still getting
+this message, you should do one of the following:
+
+1) either specify includes location explicitly, using --with-mysql-includes;
+2) or specify MySQL installation root location explicitly, using --with-mysql;
+3) or make sure that the path to 'mysql_config' program is listed in
+ your PATH environment variable.
+
+To disable MySQL support, use --without-mysql option.
+******************************************************************************
+])
+else
+ AC_MSG_RESULT([$MYSQL_CFLAGS])
+fi
+
+
+AC_MSG_CHECKING([MySQL libraries])
+if test [ -z "$MYSQL_LIBS" ]
+then
+ AC_MSG_ERROR([missing libraries.
+
+******************************************************************************
+ERROR: cannot find MySQL libraries.
+
+Check that you do have MySQL libraries installed.
+The package name is typically 'mysql-devel'.
+
+If libraries are installed on your system, but you are still getting
+this message, you should do one of the following:
+
+1) either specify libraries location explicitly, using --with-mysql-libs;
+2) or specify MySQL installation root location explicitly, using --with-mysql;
+3) or make sure that the path to 'mysql_config' program is listed in
+ your PATH environment variable.
+
+To disable MySQL support, use --without-mysql option.
+******************************************************************************
+])
+else
+ AC_MSG_RESULT([$MYSQL_LIBS])
+fi
+
+
+])
+
+dnl ---------------------------------------------------------------------------
+dnl Macro: AC_CHECK_PGSQL
+dnl First check for custom PostgreSQL paths in --with-pgsql-* options.
+dnl If some paths are missing, check if pg_config exists.
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([AC_CHECK_PGSQL],[
+
+# Check for custom includes path
+if test [ -z "$ac_cv_pgsql_includes" ]
+then
+ AC_ARG_WITH([pgsql-includes],
+ AC_HELP_STRING([--with-pgsql-includes], [path to PostgreSQL header files]),
+ [ac_cv_pgsql_includes=$withval])
+fi
+if test [ -n "$ac_cv_pgsql_includes" ]
+then
+ AC_CACHE_CHECK([PostgreSQL includes], [ac_cv_pgsql_includes], [ac_cv_pgsql_includes=""])
+ PGSQL_CFLAGS="-I$ac_cv_pgsql_includes"
+fi
+
+# Check for custom library path
+if test [ -z "$ac_cv_pgsql_libs" ]
+then
+ AC_ARG_WITH([pgsql-libs],
+ AC_HELP_STRING([--with-pgsql-libs], [path to PostgreSQL libraries]),
+ [ac_cv_pgsql_libs=$withval])
+fi
+if test [ -n "$ac_cv_pgsql_libs" ]
+then
+ AC_CACHE_CHECK([PostgreSQL libraries], [ac_cv_pgsql_libs], [ac_cv_pgsql_libs=""])
+ PGSQL_LIBS="-L$ac_cv_pgsql_libs -lpq"
+fi
+
+# If some path is missing, try to autodetermine with pgsql_config
+if test [ -z "$ac_cv_pgsql_includes" -o -z "$ac_cv_pgsql_libs" ]
+then
+ if test [ -z "$pgconfig" ]
+ then
+ AC_PATH_PROG(pgconfig,pg_config)
+ fi
+ if test [ -z "$pgconfig" ]
+ then
+ AC_MSG_ERROR([pg_config executable not found
+********************************************************************************
+ERROR: cannot find PostgreSQL libraries. If you want to compile with PosgregSQL support,
+ you must either specify file locations explicitly using
+ --with-pgsql-includes and --with-pgsql-libs options, or make sure path to
+ pg_config is listed in your PATH environment variable. If you want to
+ disable PostgreSQL support, use --without-pgsql option.
+********************************************************************************
+])
+ else
+ if test [ -z "$ac_cv_pgsql_includes" ]
+ then
+ AC_MSG_CHECKING(PostgreSQL C flags)
+ PGSQL_CFLAGS="-I`${pgconfig} --includedir`"
+ AC_MSG_RESULT($PGSQL_CFLAGS)
+ fi
+ if test [ -z "$ac_cv_pgsql_libs" ]
+ then
+ AC_MSG_CHECKING(PostgreSQL linker flags)
+ PGSQL_LIBS="-L`${pgconfig} --libdir` -lpq"
+ AC_MSG_RESULT($PGSQL_LIBS)
+ fi
+ fi
+fi
+])
+
+dnl ---------------------------------------------------------------------------
+dnl Macro: SPHINX_CONFIGURE_PART
+dnl
+dnl Tells what stage is ./configure running now, nicely formatted
+dnl ---------------------------------------------------------------------------
+
+dnl SPHINX_CONFIGURE_PART(MESSAGE)
+AC_DEFUN([SPHINX_CONFIGURE_PART],[
+ AC_MSG_RESULT()
+ AC_MSG_RESULT([$1])
+ TMP=`echo $1 | sed -e sX.X-Xg`
+ AC_MSG_RESULT([$TMP])
+ AC_MSG_RESULT()
+])
+
+dnl ---------------------------------------------------------------------------
+dnl Macro: SPHINX_CHECK_DEFINE
+dnl
+dnl Checks if this symbol is defined in that header file
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([SPHINX_CHECK_DEFINE],[
+ AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[
+ AC_EGREP_CPP(YES_IS_DEFINED, [
+#include <$2>
+#ifdef $1
+YES_IS_DEFINED
+#endif
+ ], ac_cv_define_$1=yes, ac_cv_define_$1=no)
+ ])
+ if test "$ac_cv_define_$1" = "yes"; then
+ AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2])
+ fi
+])
2 api/java/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Main-Class: org.sphx.api.test
33 api/java/Makefile
@@ -0,0 +1,33 @@
+#
+# $Id$
+#
+# Makefile to automate sphinxapi.jar source builds
+#
+
+# order matters; full rebuild is always performed; but it somehow works
+SOURCES = \
+ SphinxMatch.java \
+ SphinxException.java \
+ SphinxWordInfo.java \
+ SphinxResult.java \
+ SphinxClient.java \
+ test.java
+CLASSES = $(SOURCES:.java=.class)
+
+all : sphinxapi.jar
+
+clean:
+ rm -fr org
+ rm -f sphinxapi.jar
+
+sphinxapi.jar: $(CLASSES)
+ jar cfm sphinxapi.jar MANIFEST.MF org/sphx/api
+
+.SUFFIXES: .java .class
+vpath %.class org/sphx/api
+.java.class:
+ javac -cp . -d . $<
+
+#
+# $Id$
+#
26 api/java/README
@@ -0,0 +1,26 @@
+Sphinx Java API notes
+----------------------
+
+0) THIS IS A WORK IN PROGRESS. COMPATIBILITY-BREAKING CLASS INTERFACE
+CHANGES STILL MIGHT BE PERFORMED. SUGGESTIONS ARE WELCOME.
+
+1) Officially supported JDKs are 1.5 and above.
+
+2) The code would probably build with prior JDK versions as well,
+but since JDK 1.4 is already in End-Of-Life transition period,
+this could be gradually dropped.
+
+3) To build `sphinxapi.jar':
+
+ - make sure that `javac' and `jar' are in PATH
+ - make sure JAVA_HOME is properly set
+ - issue `make'
+
+4) To run sample client program:
+
+ - issue `java -jar sphinxapi.jar'
+
+5) Warnings about "unchecked" mode on 1.5+ are caused by keeping
+the code compatible with 1.4. Fix suggestions are welcome.
+
+--eof--
1,126 api/java/SphinxClient.java
@@ -0,0 +1,1126 @@
+/*
+ * $Id: SphinxClient.java 1526 2008-10-29 15:08:12Z shodan $
+ *
+ * Java version of Sphinx searchd client (Java API)
+ *
+ * Copyright (c) 2007-2008, Andrew Aksyonoff
+ * Copyright (c) 2007, Vladimir Fedorkov
+ * All rights reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License. You should have
+ * received a copy of the GPL license along with this program; if you
+ * did not, you can find it at http://www.gnu.org/
+ */
+
+package org.sphx.api;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/** Sphinx client class */
+public class SphinxClient
+{
+ /* matching modes */
+ public final static int SPH_MATCH_ALL = 0;
+ public final static int SPH_MATCH_ANY = 1;
+ public final static int SPH_MATCH_PHRASE = 2;
+ public final static int SPH_MATCH_BOOLEAN = 3;
+ public final static int SPH_MATCH_EXTENDED = 4;
+ public final static int SPH_MATCH_FULLSCAN = 5;
+ public final static int SPH_MATCH_EXTENDED2 = 6;
+
+ /* ranking modes (extended2 only) */
+ public final static int SPH_RANK_PROXIMITY_BM25 = 0;
+ public final static int SPH_RANK_BM25 = 1;
+ public final static int SPH_RANK_NONE = 2;
+ public final static int SPH_RANK_WORDCOUNT = 3;
+
+ /* sorting modes */
+ public final static int SPH_SORT_RELEVANCE = 0;
+ public final static int SPH_SORT_ATTR_DESC = 1;
+ public final static int SPH_SORT_ATTR_ASC = 2;
+ public final static int SPH_SORT_TIME_SEGMENTS = 3;
+ public final static int SPH_SORT_EXTENDED = 4;
+ public final static int SPH_SORT_EXPR = 5;
+
+ /* grouping functions */
+ public final static int SPH_GROUPBY_DAY = 0;
+ public final static int SPH_GROUPBY_WEEK = 1;
+ public final static int SPH_GROUPBY_MONTH = 2;
+ public final static int SPH_GROUPBY_YEAR = 3;
+ public final static int SPH_GROUPBY_ATTR = 4;
+ public final static int SPH_GROUPBY_ATTRPAIR = 5;
+
+ /* searchd reply status codes */
+ public final static int SEARCHD_OK = 0;
+ public final static int SEARCHD_ERROR = 1;
+ public final static int SEARCHD_RETRY = 2;
+ public final static int SEARCHD_WARNING = 3;
+
+ /* attribute types */
+ public final static int SPH_ATTR_INTEGER = 1;
+ public final static int SPH_ATTR_TIMESTAMP = 2;
+ public final static int SPH_ATTR_ORDINAL = 3;
+ public final static int SPH_ATTR_BOOL = 4;
+ public final static int SPH_ATTR_FLOAT = 5;
+ public final static int SPH_ATTR_MULTI = 0x40000000;
+
+
+ /* searchd commands */
+ private final static int SEARCHD_COMMAND_SEARCH = 0;
+ private final static int SEARCHD_COMMAND_EXCERPT = 1;
+ private final static int SEARCHD_COMMAND_UPDATE = 2;
+ private final static int SEARCHD_COMMAND_KEYWORDS = 3;
+
+ /* searchd command versions */
+ private final static int VER_MAJOR_PROTO = 0x1;
+ private final static int VER_COMMAND_SEARCH = 0x113;
+ private final static int VER_COMMAND_EXCERPT = 0x100;
+ private final static int VER_COMMAND_UPDATE = 0x101;
+ private final static int VER_COMMAND_KEYWORDS = 0x100;
+
+ /* filter types */
+ private final static int SPH_FILTER_VALUES = 0;
+ private final static int SPH_FILTER_RANGE = 1;
+ private final static int SPH_FILTER_FLOATRANGE = 2;
+
+
+ private String _host;
+ private int _port;
+ private int _offset;
+ private int _limit;
+ private int _mode;
+ private int[] _weights;
+ private int _sort;
+ private String _sortby;
+ private int _minId;
+ private int _maxId;
+ private ByteArrayOutputStream _rawFilters;
+ private DataOutputStream _filters;
+ private int _filterCount;
+ private String _groupBy;
+ private int _groupFunc;
+ private String _groupSort;
+ private String _groupDistinct;
+ private int _maxMatches;
+ private int _cutoff;
+ private int _retrycount;
+ private int _retrydelay;
+ private String _latitudeAttr;
+ private String _longitudeAttr;
+ private float _latitude;
+ private float _longitude;
+ private String _error;
+ private String _warning;
+ private ArrayList _reqs;
+ private Map _indexWeights;
+ private int _ranker;
+ private int _maxQueryTime;
+ private Map _fieldWeights;
+
+ private static final int SPH_CLIENT_TIMEOUT_MILLISEC = 30000;
+
+ /** Creates a new SphinxClient instance. */
+ public SphinxClient()
+ {
+ this("localhost", 3312);
+ }
+
+ /** Creates a new SphinxClient instance, with host:port specification. */
+ public SphinxClient(String host, int port)
+ {
+ _host = host;
+ _port = port;
+ _offset = 0;
+ _limit = 20;
+ _mode = SPH_MATCH_ALL;
+ _sort = SPH_SORT_RELEVANCE;
+ _sortby = "";
+ _minId = 0;
+ _maxId = 0;
+
+ _filterCount = 0;
+ _rawFilters = new ByteArrayOutputStream();
+ _filters = new DataOutputStream(_rawFilters);
+
+ _groupBy = "";
+ _groupFunc = SPH_GROUPBY_DAY;
+ _groupSort = "@group desc";
+ _groupDistinct = "";
+
+ _maxMatches = 1000;
+ _cutoff = 0;
+ _retrycount = 0;
+ _retrydelay = 0;
+
+ _latitudeAttr = null;
+ _longitudeAttr = null;
+ _latitude = 0;
+ _longitude = 0;
+
+ _error = "";
+ _warning = "";
+
+ _reqs = new ArrayList();
+ _weights = null;
+ _indexWeights = new LinkedHashMap();
+ _fieldWeights = new LinkedHashMap();
+ _ranker = SPH_RANK_PROXIMITY_BM25;
+ }
+
+ /** Get last error message, if any. */
+ public String GetLastError()
+ {
+ return _error;
+ }
+
+ /** Get last warning message, if any. */
+ public String GetLastWarning()
+ {
+ return _warning;
+ }
+
+ /** Set searchd host and port to connect to. */
+ public void SetServer(String host, int port) throws SphinxException
+ {
+ myAssert ( host!=null && host.length()>0, "host name must not be empty" );
+ myAssert ( port>0 && port<65536, "port must be in 1..65535 range" );
+ _host = host;
+ _port = port;
+ }
+
+ /** Internal method. Sanity check. */
+ private void myAssert ( boolean condition, String err ) throws SphinxException
+ {
+ if ( !condition )
+ {
+ _error = err;
+ throw new SphinxException ( err );
+ }
+ }
+
+ /** Internal method. String IO helper. */
+ private static void writeNetUTF8 ( DataOutputStream ostream, String str ) throws IOException
+ {
+ if ( str==null )
+ {
+ ostream.writeInt ( 0 );
+ return;
+ }
+
+ byte[] sBytes = str.getBytes ( "UTF-8" );
+ int iLen = sBytes.length;
+
+ ostream.writeInt ( iLen );
+ ostream.write ( sBytes );
+ }
+
+ /** Internal method. String IO helper. */
+ private static String readNetUTF8(DataInputStream istream) throws IOException
+ {
+ istream.readUnsignedShort (); /* searchd emits dword lengths, but Java expects words; lets just skip first 2 bytes */
+ return istream.readUTF ();
+ }
+
+ /** Internal method. Unsigned int IO helper. */
+ private static long readDword ( DataInputStream istream ) throws IOException
+ {
+ long v = (long) istream.readInt ();
+ if ( v<0 )
+ v += 4294967296L;
+ return v;
+ }
+
+ /** Internal method. Connect to searchd and exchange versions. */
+ private Socket _Connect()
+ {
+ Socket sock = null;
+ try
+ {
+ sock = new Socket ( _host, _port );
+ sock.setSoTimeout ( SPH_CLIENT_TIMEOUT_MILLISEC );
+
+ DataInputStream sIn = new DataInputStream ( sock.getInputStream() );
+ int version = sIn.readInt();
+ if ( version<1 )
+ {
+ sock.close ();
+ _error = "expected searchd protocol version 1+, got version " + version;
+ return null;
+ }
+
+ DataOutputStream sOut = new DataOutputStream ( sock.getOutputStream() );
+ sOut.writeInt ( VER_MAJOR_PROTO );
+
+ } catch ( IOException e )
+ {
+ _error = "connection to " + _host + ":" + _port + " failed: " + e;
+
+ try
+ {
+ if ( sock!=null )
+ sock.close ();
+ } catch ( IOException e1 ) {}
+ return null;
+ }
+
+ return sock;
+ }
+
+ /** Internal method. Get and check response packet from searchd. */
+ private byte[] _GetResponse ( Socket sock )
+ {
+ /* connect */
+ DataInputStream sIn = null;
+ InputStream SockInput = null;
+ try
+ {
+ SockInput = sock.getInputStream();
+ sIn = new DataInputStream ( SockInput );
+
+ } catch ( IOException e )
+ {
+ _error = "getInputStream() failed: " + e;
+ return null;
+ }
+
+ /* read response */
+ byte[] response = null;
+ short status = 0, ver = 0;
+ int len = 0;
+ try
+ {
+ /* read status fields */
+ status = sIn.readShort();
+ ver = sIn.readShort();
+ len = sIn.readInt();
+
+ /* read response if non-empty */
+ if ( len<=0 )
+ {
+ _error = "invalid response packet size (len=" + len + ")";
+ return null;
+ }
+
+ response = new byte[len];
+ sIn.readFully ( response, 0, len );
+
+ /* check status */
+ if ( status==SEARCHD_WARNING )
+ {
+ DataInputStream in = new DataInputStream ( new ByteArrayInputStream ( response ) );
+
+ int iWarnLen = in.readInt ();
+ _warning = new String ( response, 4, iWarnLen );
+
+ System.arraycopy ( response, 4+iWarnLen, response, 0, response.length-4-iWarnLen );
+
+ } else if ( status==SEARCHD_ERROR )
+ {
+ _error = "searchd error: " + new String ( response, 4, response.length-4 );
+ return null;
+
+ } else if ( status==SEARCHD_RETRY )
+ {
+ _error = "temporary searchd error: " + new String ( response, 4, response.length-4 );
+ return null;
+
+ } else if ( status!=SEARCHD_OK )
+ {
+ _error = "searched returned unknown status, code=" + status;
+ return null;
+ }
+
+ } catch ( IOException e )
+ {
+ if ( len!=0 )
+ {
+ /* get trace, to provide even more failure details */
+ PrintWriter ew = new PrintWriter ( new StringWriter() );
+ e.printStackTrace ( ew );
+ ew.flush ();
+ ew.close ();
+ String sTrace = ew.toString ();
+
+ /* build error message */
+ _error = "failed to read searchd response (status=" + status + ", ver=" + ver + ", len=" + len + ", trace=" + sTrace +")";
+ } else
+ {
+ _error = "received zero-sized searchd response (searchd crashed?): " + e.getMessage();
+ }
+ return null;
+
+ } finally
+ {
+ try
+ {
+ if ( sIn!=null ) sIn.close();
+ if ( sock!=null && !sock.isConnected() ) sock.close();
+ } catch ( IOException e )
+ {
+ /* silently ignore close failures; nothing could be done anyway */
+ }
+ }
+
+ return response;
+ }
+
+ /** Internal method. Connect to searchd, send request, get response as DataInputStream. */
+ private DataInputStream _DoRequest ( int command, int version, ByteArrayOutputStream req )
+ {
+ /* connect */
+ Socket sock = _Connect();
+ if ( sock==null )
+ return null;
+
+ /* send request */
+ byte[] reqBytes = req.toByteArray();
+ try
+ {
+ DataOutputStream sockDS = new DataOutputStream ( sock.getOutputStream() );
+ sockDS.writeShort ( command );
+ sockDS.writeShort ( version );
+ sockDS.writeInt ( reqBytes.length );
+ sockDS.write ( reqBytes );
+
+ } catch ( Exception e )
+ {
+ _error = "network error: " + e;
+ return null;
+ }
+
+ /* get response */
+ byte[] response = _GetResponse ( sock );
+ if ( response==null )
+ return null;
+
+ /* spawn that tampon */
+ return new DataInputStream ( new ByteArrayInputStream ( response ) );
+ }
+
+ /** Set matches offset and limit to return to client, max matches to retrieve on server, and cutoff. */
+ public void SetLimits ( int offset, int limit, int max, int cutoff ) throws SphinxException
+ {
+ myAssert ( offset>=0, "offset must not be negative" );
+ myAssert ( limit>0, "limit must be positive" );
+ myAssert ( max>0, "max must be positive" );
+ myAssert ( cutoff>=0, "cutoff must not be negative" );
+
+ _offset = offset;
+ _limit = limit;
+ _maxMatches = max;
+ _cutoff = cutoff;
+ }
+
+ /** Set matches offset and limit to return to client, and max matches to retrieve on server. */
+ public void SetLimits ( int offset, int limit, int max ) throws SphinxException
+ {
+ SetLimits ( offset, limit, max, _cutoff );
+ }
+
+ /** Set matches offset and limit to return to client. */
+ public void SetLimits ( int offset, int limit) throws SphinxException
+ {
+ SetLimits ( offset, limit, _maxMatches, _cutoff );
+ }
+
+ /** Set maximum query time, in milliseconds, per-index, 0 means "do not limit". */
+ public void SetMaxQueryTime ( int maxTime ) throws SphinxException
+ {
+ myAssert ( maxTime>=0, "max_query_time must not be negative" );
+ _maxQueryTime = maxTime;
+ }
+
+ /** Set matching mode. */
+ public void SetMatchMode(int mode) throws SphinxException
+ {
+ myAssert (
+ mode==SPH_MATCH_ALL ||
+ mode==SPH_MATCH_ANY ||
+ mode==SPH_MATCH_PHRASE ||
+ mode==SPH_MATCH_BOOLEAN ||
+ mode==SPH_MATCH_EXTENDED ||
+ mode==SPH_MATCH_EXTENDED2, "unknown mode value; use one of the SPH_MATCH_xxx constants" );
+ _mode = mode;
+ }
+
+ /** Set ranking mode. */
+ public void SetRankingMode ( int ranker ) throws SphinxException
+ {
+ myAssert ( ranker==SPH_RANK_PROXIMITY_BM25
+ || ranker==SPH_RANK_BM25
+ || ranker==SPH_RANK_NONE
+ || ranker==SPH_RANK_WORDCOUNT, "unknown ranker value; use one of the SPH_RANK_xxx constants" );
+ _ranker = ranker;
+ }
+
+ /** Set sorting mode. */
+ public void SetSortMode ( int mode, String sortby ) throws SphinxException
+ {
+ myAssert (
+ mode==SPH_SORT_RELEVANCE ||
+ mode==SPH_SORT_ATTR_DESC ||
+ mode==SPH_SORT_ATTR_ASC ||
+ mode==SPH_SORT_TIME_SEGMENTS ||
+ mode==SPH_SORT_EXTENDED, "unknown mode value; use one of the available SPH_SORT_xxx constants" );
+ myAssert ( mode==SPH_SORT_RELEVANCE || ( sortby!=null && sortby.length()>0 ), "sortby string must not be empty in selected mode" );
+
+ _sort = mode;
+ _sortby = ( sortby==null ) ? "" : sortby;
+ }
+
+ /** Set per-field weights (all values must be positive). WARNING: DEPRECATED, use SetFieldWeights() instead. */
+ public void SetWeights(int[] weights) throws SphinxException
+ {
+ myAssert ( weights!=null, "weights must not be null" );
+ for (int i = 0; i < weights.length; i++) {
+ int weight = weights[i];
+ myAssert ( weight>0, "all weights must be greater than 0" );
+ }
+ _weights = weights;
+ }
+
+ /**
+ * Bind per-field weights by field name.
+ * @param fieldWeights hash which maps String index names to Integer weights
+ */
+ public void SetFieldeights ( Map fieldWeights ) throws SphinxException
+ {
+ /* FIXME! implement checks here */
+ _fieldWeights = ( fieldWeights==null ) ? new LinkedHashMap () : fieldWeights;
+ }
+
+ /**
+ * Bind per-index weights by index name (and enable summing the weights on duplicate matches, instead of replacing them).
+ * @param indexWeights hash which maps String index names to Integer weights
+ */
+ public void SetIndexWeights ( Map indexWeights ) throws SphinxException
+ {
+ /* FIXME! implement checks here */
+ _indexWeights = ( indexWeights==null ) ? new LinkedHashMap () : indexWeights;
+ }
+
+ /** Set document IDs range to match. */
+ public void SetIDRange ( int min, int max ) throws SphinxException
+ {
+ myAssert ( min<=max, "min must be less or equal to max" );
+ _minId = min;
+ _maxId = max;
+ }
+
+ /** Set values filter. Only match records where attribute value is in given set. */
+ public void SetFilter ( String attribute, int[] values, boolean exclude ) throws SphinxException
+ {
+ myAssert ( values!=null && values.length>0, "values array must not be null or empty" );
+ myAssert ( attribute!=null && attribute.length()>0, "attribute name must not be null or empty" );
+
+ try
+ {
+ writeNetUTF8 ( _filters, attribute );
+ _filters.writeInt ( SPH_FILTER_VALUES );
+ _filters.writeInt ( values.length );
+ for ( int i=0; i<values.length; i++ )
+ _filters.writeInt ( values[i] );
+ _filters.writeInt ( exclude ? 1 : 0 );
+
+ } catch ( Exception e )
+ {
+ myAssert ( false, "IOException: " + e.getMessage() );
+ }
+ _filterCount++;
+ }
+
+ /** Set values filter with a single value (syntax sugar; see {@link #SetFilter(String,int[],boolean)}). */
+ public void SetFilter ( String attribute, int value, boolean exclude ) throws SphinxException
+ {
+ int[] values = new int[] { value };
+ SetFilter ( attribute, values, exclude );
+ }
+
+ /** Set integer range filter. Only match records if attribute value is beetwen min and max (inclusive). */
+ public void SetFilterRange ( String attribute, int min, int max, boolean exclude ) throws SphinxException
+ {
+ myAssert ( min<=max, "min must be less or equal to max" );
+ try
+ {
+ writeNetUTF8 ( _filters, attribute );
+ _filters.writeInt ( SPH_FILTER_RANGE );
+ _filters.writeInt ( min );
+ _filters.writeInt ( max );
+ _filters.writeInt ( exclude ? 1 : 0 );
+
+ } catch ( Exception e )
+ {
+ myAssert ( false, "IOException: " + e.getMessage() );
+ }
+ _filterCount++;
+ }
+
+ /** Set float range filter. Only match records if attribute value is beetwen min and max (inclusive). */
+ public void SetFilterFloatRange ( String attribute, float min, float max, boolean exclude ) throws SphinxException
+ {
+ myAssert ( min<=max, "min must be less or equal to max" );
+ try
+ {
+ writeNetUTF8 ( _filters, attribute );
+ _filters.writeInt ( SPH_FILTER_RANGE );
+ _filters.writeFloat ( min );
+ _filters.writeFloat ( max );
+ _filters.writeInt ( exclude ? 1 : 0 );
+ } catch ( Exception e )
+ {
+ myAssert ( false, "IOException: " + e.getMessage() );
+ }
+ _filterCount++;
+ }
+
+ /** Setup geographical anchor point. Required to use @geodist in filters and sorting; distance will be computed to this point. */
+ public void SetGeoAnchor ( String latitudeAttr, String longitudeAttr, float latitude, float longitude ) throws SphinxException
+ {
+ myAssert ( latitudeAttr!=null && latitudeAttr.length()>0, "longitudeAttr string must not be null or empty" );
+ myAssert ( longitudeAttr!=null && longitudeAttr.length()>0, "longitudeAttr string must not be null or empty" );
+
+ _latitudeAttr = latitudeAttr;
+ _longitudeAttr = longitudeAttr;
+ _latitude = latitude;
+ _longitude = longitude;
+ }
+
+ /** Set grouping attribute and function. */
+ public void SetGroupBy ( String attribute, int func, String groupsort ) throws SphinxException
+ {
+ myAssert (
+ func==SPH_GROUPBY_DAY ||
+ func==SPH_GROUPBY_WEEK ||
+ func==SPH_GROUPBY_MONTH ||
+ func==SPH_GROUPBY_YEAR ||
+ func==SPH_GROUPBY_ATTR ||
+ func==SPH_GROUPBY_ATTRPAIR, "unknown func value; use one of the available SPH_GROUPBY_xxx constants" );
+
+ _groupBy = attribute;
+ _groupFunc = func;
+ _groupSort = groupsort;
+ }
+
+ /** Set grouping attribute and function with default ("@group desc") groupsort (syntax sugar). */
+ public void SetGroupBy(String attribute, int func) throws SphinxException
+ {
+ SetGroupBy(attribute, func, "@group desc");
+ }
+
+ /** Set count-distinct attribute for group-by queries. */
+ public void SetGroupDistinct(String attribute)
+ {
+ _groupDistinct = attribute;
+ }
+
+ /** Set distributed retries count and delay. */
+ public void SetRetries ( int count, int delay ) throws SphinxException
+ {
+ myAssert ( count>=0, "count must not be negative" );
+ myAssert ( delay>=0, "delay must not be negative" );
+ _retrycount = count;
+ _retrydelay = delay;
+ }
+
+ /** Set distributed retries count with default (zero) delay (syntax sugar). */
+ public void SetRetries ( int count ) throws SphinxException
+ {
+ SetRetries ( count, 0 );
+ }
+
+ /** Reset all currently set filters (for multi-queries). */
+ public void ResetFilters()
+ {
+ /* should we close them first? */
+ _rawFilters = new ByteArrayOutputStream();
+ _filters = new DataOutputStream(_rawFilters);
+ _filterCount = 0;
+
+ /* reset GEO anchor */
+ _latitudeAttr = null;
+ _longitudeAttr = null;
+ _latitude = 0;
+ _longitude = 0;
+ }
+
+ /** Connect to searchd server and run current search query against all indexes (syntax sugar). */
+ public SphinxResult Query ( String query ) throws SphinxException
+ {
+ return Query ( query, "*", "" );
+ }
+
+ /** Connect to searchd server and run current search query against all indexes (syntax sugar). */
+ public SphinxResult Query ( String query, String index ) throws SphinxException
+ {
+ return Query ( query, index, "" );
+ }
+
+ /** Connect to searchd server and run current search query. */
+ public SphinxResult Query ( String query, String index, String comment ) throws SphinxException
+ {
+ myAssert ( _reqs==null || _reqs.size()==0, "AddQuery() and Query() can not be combined; use RunQueries() instead" );
+
+ AddQuery ( query, index, comment );
+ SphinxResult[] results = RunQueries();
+ if (results == null || results.length < 1) {
+ return null; /* probably network error; error message should be already filled */
+ }
+
+
+ SphinxResult res = results[0];
+ _warning = res.warning;
+ _error = res.error;
+ if (res == null || res.getStatus() == SEARCHD_ERROR) {
+ return null;
+ } else {
+ return res;
+ }
+ }
+
+ /** Add new query with current settings to current search request. */
+ public int AddQuery ( String query, String index, String comment ) throws SphinxException
+ {
+ ByteArrayOutputStream req = new ByteArrayOutputStream();
+
+ /* build request */
+ try {
+ DataOutputStream out = new DataOutputStream(req);
+ out.writeInt(_offset);
+ out.writeInt(_limit);
+ out.writeInt(_mode);
+ out.writeInt(_ranker);
+ out.writeInt(_sort);
+ writeNetUTF8(out, _sortby);
+ writeNetUTF8(out, query);
+ int weightLen = _weights != null ? _weights.length : 0;
+
+ out.writeInt(weightLen);
+ if (_weights != null) {
+ for (int i = 0; i < _weights.length; i++)
+ out.writeInt(_weights[i]);
+ }
+
+ writeNetUTF8(out, index);
+ out.writeInt(0);
+ out.writeInt(_minId);
+ out.writeInt(_maxId);
+
+ /* filters */
+ out.writeInt(_filterCount);
+ out.write(_rawFilters.toByteArray());
+
+ /* group-by, max matches, sort-by-group flag */
+ out.writeInt(_groupFunc);
+ writeNetUTF8(out, _groupBy);
+ out.writeInt(_maxMatches);
+ writeNetUTF8(out, _groupSort);
+
+ out.writeInt(_cutoff);
+ out.writeInt(_retrycount);
+ out.writeInt(_retrydelay);
+
+ writeNetUTF8(out, _groupDistinct);
+
+ /* anchor point */
+ if (_latitudeAttr == null || _latitudeAttr.length() == 0 || _longitudeAttr == null || _longitudeAttr.length() == 0) {
+ out.writeInt(0);
+ } else {
+ out.writeInt(1);
+ writeNetUTF8(out, _latitudeAttr);
+ writeNetUTF8(out, _longitudeAttr);
+ out.writeFloat(_latitude);
+ out.writeFloat(_longitude);
+
+ }
+
+ /* per-index weights */
+ out.writeInt(_indexWeights.size());
+ for (Iterator e = _indexWeights.keySet().iterator(); e.hasNext();) {
+ String indexName = (String) e.next();
+ Integer weight = (Integer) _indexWeights.get(indexName);
+ writeNetUTF8(out, indexName);
+ out.writeInt(weight.intValue());
+ }
+
+ /* max query time */
+ out.writeInt ( _maxQueryTime );
+
+ /* per-field weights */
+ out.writeInt ( _fieldWeights.size() );
+ for ( Iterator e=_fieldWeights.keySet().iterator(); e.hasNext(); )
+ {
+ String field = (String) e.next();
+ Integer weight = (Integer) _fieldWeights.get ( field );
+ writeNetUTF8 ( out, field );
+ out.writeInt ( weight.intValue() );
+ }
+
+ /* comment */
+ writeNetUTF8 ( out, comment );
+
+ /* done! */
+ out.flush ();
+ int qIndex = _reqs.size();
+ _reqs.add ( qIndex, req.toByteArray() );
+ return qIndex;
+
+ } catch ( Exception e )
+ {
+ myAssert ( false, "error in AddQuery(): " + e + ": " + e.getMessage() );
+
+ } finally
+ {
+ try
+ {
+ _filters.close ();
+ _rawFilters.close ();
+ } catch ( IOException e )
+ {
+ myAssert ( false, "error in AddQuery(): " + e + ": " + e.getMessage() );
+ }
+ }
+ return -1;
+ }
+
+ /** Run all previously added search queries. */
+ public SphinxResult[] RunQueries() throws SphinxException
+ {
+ if ( _reqs==null || _reqs.size()<1 )
+ {
+ _error = "no queries defined, issue AddQuery() first";
+ return null;
+ }
+
+ /* build the mega-request */
+ int nreqs = _reqs.size();
+ ByteArrayOutputStream reqBuf = new ByteArrayOutputStream();
+ try
+ {
+ DataOutputStream req = new DataOutputStream ( reqBuf );
+ req.writeInt ( nreqs );
+ for ( int i=0; i<nreqs; i++ )
+ req.write ( (byte[]) _reqs.get(i) );
+ req.flush ();
+
+ } catch ( Exception e )
+ {
+ _error = "internal error: failed to build request: " + e;
+ return null;
+ }
+
+ DataInputStream in =_DoRequest ( SEARCHD_COMMAND_SEARCH, VER_COMMAND_SEARCH, reqBuf );
+ if ( in==null )
+ return null;
+
+ SphinxResult[] results = new SphinxResult [ nreqs ];
+ _reqs = new ArrayList();
+
+ try
+ {
+ for ( int ires=0; ires<nreqs; ires++ )
+ {
+ SphinxResult res = new SphinxResult();
+ results[ires] = res;
+
+ int status = in.readInt();
+ res.setStatus ( status );
+ if (status != SEARCHD_OK) {
+ String message = readNetUTF8(in);
+ if (status == SEARCHD_WARNING) {
+ res.warning = message;
+ } else {
+ res.error = message;
+ continue;
+ }
+ }
+
+ /* read fields */
+ int nfields = in.readInt();
+ res.fields = new String[nfields];
+ int pos = 0;
+ for (int i = 0; i < nfields; i++)
+ res.fields[i] = readNetUTF8(in);
+
+ /* read arrts */
+ int nattrs = in.readInt();
+ res.attrTypes = new int[nattrs];
+ res.attrNames = new String[nattrs];
+ for (int i = 0; i < nattrs; i++) {
+ String AttrName = readNetUTF8(in);