lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: MoreLikeThis class in Lucene within Solr?
Date Tue, 12 Sep 2006 15:39:37 GMT

: Is it possible in any way to use the MoreLikeThis class with solr
: (http://lucene.apache.org/java/docs/api/org/apache/lucene/search/similar/MoreLikeThis.html)?
: Right now I'm determining similar docs by just querying for the whole
: body with OR between words, and it's not very efficient performance
: wise. I never coded in Java so I really don't know where I should start...

MoreLikeThis could certainly be used in a custom request handler --
there's nothing that does it out of the box however.

if you wanted to implement it, you'd need to start by getting comfortable
compiling java classes -- if you can write a little HellowWorld.java app
and compile it then you can probably compile the solr source tree.
Find yourself a Java Basics tutorial (or a "Java for ___ developers
tutorial" if you can based on whatever language you understand the
most) -- in addition this little ant tutorial might be helpful if you
aren't very familiar with ant either..

http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html

...once you can build the Solr source, try writing your own class tat
implements SOlrRequestHandler ... most of hte methods are just for
statistics and can just return constant values, the only one that you
really need to put any meat into is handleRequest -- you can make it work
a lot like the MoreLikeThis.main method, the biggest differences being:
  * get your input from the SolrQueryRequest.getParams()
  * put your output in the SolrQueryResponse
  * you don't need to open your own Directory, IndexReader, or
IndexSearcher, just use SolrQueryRequest.getSearcher().getReader()

(don't forget to register your new handler in your solrconfig.xml so you
can try it out)

if you run into problems, feel free to post your code and get feedback.

-Hoss


Mime
View raw message