apache / lucene

Apache Lucene open-source search software
https://lucene.apache.org/
Apache License 2.0
2.39k stars 948 forks source link

BoostingNearQuery class (prototype) [LUCENE-1341] #2418

Closed asfimport closed 14 years ago

asfimport commented 15 years ago

This patch implements term boosting for SpanNearQuery. Refer to: http://www.gossamer-threads.com/lists/lucene/java-user/62779

This patch works but probably needs more work. I don't like the use of 'instanceof', but I didn't want to touch Spans or TermSpans. Also, the payload code is mostly a copy of what's in BoostingTermQuery and could be common-sourced somewhere. Feel free to throw darts at it :)


Migrated from LUCENE-1341 by Peter Keegan, resolved Aug 06 2009 Attachments: bnq.patch (versions: 2), BoostingNearQuery.java (versions: 2), LUCENE-1341.patch (versions: 2), LUCENE-1341-new.patch, lucene-1341-new-1.patch, lucene-1341-new-2.patch Linked issues:

asfimport commented 15 years ago

Peter Keegan (migrated from JIRA)

Note that this patch requires java 1.5 or later (easily modified to run on 1.4)

asfimport commented 15 years ago

Peter Keegan (migrated from JIRA)

Here is version of patch for Java 1.4

asfimport commented 15 years ago

Grant Ingersoll (@gsingers) (migrated from JIRA)

Some minor updates. Makes the Near spans public and moves the BNQ to the payloads package.

Peter, we need tests before this can be committed.

asfimport commented 15 years ago

Peter Keegan (migrated from JIRA)

Here is an updated patch for the 2.4 branch. It's 6 months late because I missed Grant's e-mail requesting me to retest. I was just recently looking to see what became of the original patch.

Peter

asfimport commented 15 years ago

Grant Ingersoll (@gsingers) (migrated from JIRA)

Hi Peter,

This looks good, I think it just needs some unit tests and then it will be good.

asfimport commented 15 years ago

Peter Keegan (migrated from JIRA)

As I was debugging a unit test for BoostingNearQuery, I discovered that not all the payloads were getting read. The 'needToLoadPayload' flag on the termpos was getting reset on the last term in the span by NearSpansOrdered. Then I noticed that the term positions aren't even needed in BNQ because they were already collected by the Spans in 'matchPayload'. So, here is a newer, simpler implementation of BNQ along with some unit tests.

Peter

asfimport commented 14 years ago

Grant Ingersoll (@gsingers) (migrated from JIRA)

Peter, can you bring this up to date? I think this could go into 2.9 if you can do so fairly quickly.

asfimport commented 14 years ago

Peter Keegan (migrated from JIRA)

New version that works with current trunk (8/5/09)

asfimport commented 14 years ago

Grant Ingersoll (@gsingers) (migrated from JIRA)

Minor mods and some javadocs. Looks pretty good.

I made sumPayloads more generic and protected, so that one could override it and do other things besides sum.

asfimport commented 14 years ago

Grant Ingersoll (@gsingers) (migrated from JIRA)

Committed revision 801667. thanks Peter!