Re: using BoostingTermQuery
In the solrconfig.xml (scroll all the way to the bottom, and I believe the example has some commented out) On Dec 15, 2008, at 5:45 AM, ayyanar wrote: I'm no QueryParser expert, but I would probably start w/ the default query parser in Solr (LuceneQParser), and then progress a bit to the DisMax one. I'd ask specific questions based on what you see there. If you get far enough along, you may consider asking for help on the java-user list as well. Thanks - I think I've got it working now. I ended up subclassing QueryParser and overriding >newTermQuery() to create a BoostingTermQuery instead of a plain ol' TermQuery. Seems to work. Kindly let me know where and how to configure the overridden query parser in solr -Ayyanar -- View this message in context: http://www.nabble.com/using-BoostingTermQuery-tp19637123p21011626.html Sent from the Solr - User mailing list archive at Nabble.com. -- Grant Ingersoll Lucene Helpful Hints: http://wiki.apache.org/lucene-java/BasicsOfPerformance http://wiki.apache.org/lucene-java/LuceneFAQ
Re: using BoostingTermQuery
> I'm no QueryParser expert, but I would probably start w/ the default > query parser in Solr (LuceneQParser), and then progress a bit to the > DisMax one. I'd ask specific questions based on what you see there. > If you get far enough along, you may consider asking for help on the > java-user list as well. >Thanks - I think I've got it working now. I ended up subclassing QueryParser and overriding >newTermQuery() to create a BoostingTermQuery instead of a plain ol' TermQuery. Seems to work. Kindly let me know where and how to configure the overridden query parser in solr -Ayyanar -- View this message in context: http://www.nabble.com/using-BoostingTermQuery-tp19637123p21011626.html Sent from the Solr - User mailing list archive at Nabble.com.
RE: using BoostingTermQuery
> I'm no QueryParser expert, but I would probably start w/ the default > query parser in Solr (LuceneQParser), and then progress a bit to the > DisMax one. I'd ask specific questions based on what you see there. > If you get far enough along, you may consider asking for help on the > java-user list as well. Thanks - I think I've got it working now. I ended up subclassing QueryParser and overriding newTermQuery() to create a BoostingTermQuery instead of a plain ol' TermQuery. Seems to work. > > Yup - I'm pretty sure I have that side figured out. My input > > contains terms marked up with a score (ie 'software?7') I just > > needed to create a TokenFilter that parses out the suffix and sets > > the Payload on the token. > > Cool. Patch? Not sure how valuable it is - all I did was create a new subclass of TokenFilter. Here's the code fwiw: public class ScorePayloadFilter extends TokenFilter { protected ScorePayloadFilter(TokenStream input) { super(input); } public Token next(Token in) throws IOException { Token nextToken = input.next(in); if ( nextToken != null ) { char[] buf = nextToken.termBuffer(); int termLen = nextToken.termLength(); int posn = -1; for ( int i=0; i < termLen; i++ ) if ( buf[i] == '?' ) posn = i; if ( posn > 0 ) { int scorepos = posn + 1; String score = new String(buf, scorepos, termLen - scorepos); Integer scoreInt = new Integer(score); Payload payload = new Payload(); byte[] payloadBytes = new byte[4]; payload.setData(PayloadHelper.encodeInt(scoreInt, payloadBytes, 0)); nextToken.setPayload(payload); nextToken.setTermLength(posn); } } return nextToken; } } Thanks again for the help! -Ken
Re: using BoostingTermQuery
On Sep 23, 2008, at 5:39 PM, Ensdorf Ken wrote: At this point, it's roll your own. That's where I'm getting bogged down - I'm confused by the various queryparser classes in lucene and solr and I'm not sure exactly what I need to override. Do you know of an example of something similar to what I'm doing that I could use as a reference? I'm no QueryParser expert, but I would probably start w/ the default query parser in Solr (LuceneQParser), and then progress a bit to the DisMax one. I'd ask specific questions based on what you see there. If you get far enough along, you may consider asking for help on the java-user list as well. I'd love to see the BTQ in Solr (and Spans!), but I wonder if it makes sense w/o better indexing side support. I assume you are rolling your own Analyzer, right? Yup - I'm pretty sure I have that side figured out. My input contains terms marked up with a score (ie 'software?7') I just needed to create a TokenFilter that parses out the suffix and sets the Payload on the token. Cool. Patch? Spans and payloads are this huge untapped area for better search! Completely agree - we do a lot with keyword searching, and we use this type of thing in our existing search implementation. Thanks for the quick response! On Sep 23, 2008, at 5:12 PM, Ensdorf Ken wrote: Hi- I'm new to Solr, and I'm trying to figure out the best way to configure it to use BoostingTermQuery in the scoring mechanism. Do I need to create a custom query parser? All I want is the default parser behavior except to get the custom term boost from the Payload data. Thanks! -Ken -- Grant Ingersoll http://www.lucidimagination.com Lucene Helpful Hints: http://wiki.apache.org/lucene-java/BasicsOfPerformance http://wiki.apache.org/lucene-java/LuceneFAQ -- Grant Ingersoll http://www.lucidimagination.com Lucene Helpful Hints: http://wiki.apache.org/lucene-java/BasicsOfPerformance http://wiki.apache.org/lucene-java/LuceneFAQ
RE: using BoostingTermQuery
> At this point, it's roll your own. That's where I'm getting bogged down - I'm confused by the various queryparser classes in lucene and solr and I'm not sure exactly what I need to override. Do you know of an example of something similar to what I'm doing that I could use as a reference? > I'd love to see the BTQ in Solr > (and Spans!), but I wonder if it makes sense w/o better indexing side > support. I assume you are rolling your own Analyzer, right? Yup - I'm pretty sure I have that side figured out. My input contains terms marked up with a score (ie 'software?7') I just needed to create a TokenFilter that parses out the suffix and sets the Payload on the token. > Spans and payloads are this huge untapped area for better search! Completely agree - we do a lot with keyword searching, and we use this type of thing in our existing search implementation. Thanks for the quick response! > On Sep 23, 2008, at 5:12 PM, Ensdorf Ken wrote: > > > Hi- > > > > I'm new to Solr, and I'm trying to figure out the best way to > > configure it to use BoostingTermQuery in the scoring mechanism. Do > > I need to create a custom query parser? All I want is the default > > parser behavior except to get the custom term boost from the Payload > > data. Thanks! > > > > -Ken > > -- > Grant Ingersoll > http://www.lucidimagination.com > > Lucene Helpful Hints: > http://wiki.apache.org/lucene-java/BasicsOfPerformance > http://wiki.apache.org/lucene-java/LuceneFAQ > > > > > > > >
Re: using BoostingTermQuery
It may be too early to say this but I'll say it anyway :) There should be a juicy case study that includes payloads, BTQ, and Spans in the upcoming Lucene in Action 2. I can't wait to see it, personally. Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - Original Message > From: Grant Ingersoll <[EMAIL PROTECTED]> > To: solr-user@lucene.apache.org > Sent: Tuesday, September 23, 2008 5:29:05 PM > Subject: Re: using BoostingTermQuery > > At this point, it's roll your own. I'd love to see the BTQ in Solr > (and Spans!), but I wonder if it makes sense w/o better indexing side > support. I assume you are rolling your own Analyzer, right? Spans > and payloads are this huge untapped area for better search! > > > On Sep 23, 2008, at 5:12 PM, Ensdorf Ken wrote: > > > Hi- > > > > I'm new to Solr, and I'm trying to figure out the best way to > > configure it to use BoostingTermQuery in the scoring mechanism. Do > > I need to create a custom query parser? All I want is the default > > parser behavior except to get the custom term boost from the Payload > > data. Thanks! > > > > -Ken > > -- > Grant Ingersoll > http://www.lucidimagination.com > > Lucene Helpful Hints: > http://wiki.apache.org/lucene-java/BasicsOfPerformance > http://wiki.apache.org/lucene-java/LuceneFAQ
Re: using BoostingTermQuery
At this point, it's roll your own. I'd love to see the BTQ in Solr (and Spans!), but I wonder if it makes sense w/o better indexing side support. I assume you are rolling your own Analyzer, right? Spans and payloads are this huge untapped area for better search! On Sep 23, 2008, at 5:12 PM, Ensdorf Ken wrote: Hi- I'm new to Solr, and I'm trying to figure out the best way to configure it to use BoostingTermQuery in the scoring mechanism. Do I need to create a custom query parser? All I want is the default parser behavior except to get the custom term boost from the Payload data. Thanks! -Ken -- Grant Ingersoll http://www.lucidimagination.com Lucene Helpful Hints: http://wiki.apache.org/lucene-java/BasicsOfPerformance http://wiki.apache.org/lucene-java/LuceneFAQ