lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <gsing...@apache.org>
Subject Re: Faceting with payloads
Date Fri, 08 Feb 2008 18:08:35 GMT

On Feb 8, 2008, at 12:17 PM, Karl Wettin wrote:

>
> 6 feb 2008 kl. 23.10 skrev Matt Ronge:
>
>> I may index the token "house" maybe found in different places with  
>> different types. If the user query contains house, I want to report  
>> the number of instances of the token house of type A, type B and so  
>> on.
>>
>> Should I be using payloads for this? If so, I'd like to be able to  
>> count up all the instances of for each type. Then I can show the  
>> results, along with TypeA (100 hits), TypeB (1000 hits) so on.
>
> Pehaps, what do you do with these numbers you extract?
>
>> If I could use something like HitCollector that was passed in the  
>> token payload, that would be perfect, but it doesn't support that.  
>> Any thoughts on how to go about this? Also, if I want to only allow  
>> tokens of TypeB, how can I efficiently filter by TypeB; using a  
>> Similarity subclass seems like a hack.
>
> I think you will have to hack the Query classes you want to use, and  
> make their Weight share some counter thingy you can inspect after  
> invoking a Query in the Searcher. But I'm not sure.

Yeah, I agree.  Sounds like a custom Query class.  Have a look at the  
BoostingTermQuery for an example of using payloads.  Not sure yet if  
there is a generalized way to do what you want, but it does seem  
useful.  Seems almost like an expansion of Spans, in that you not only  
want the hits, but you want their positions, and then expanding it, to  
give info about payload type.

I do have a JIRA issue open about adding Payloads access to spans, but  
I haven't implemented anything I am happy with yet.  With that, you  
could iterate the spanPayloads and do your counting, too.

-Grant

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message