Question

I'm not sure how to handle the following issues. So i hope, to get here some ideas or something like that. I'm using lucene with solr. Every document (which is indexed in lucene) has an date-field an an topic - field (with some keywords)

By using faceted search, i'm able to calculate the frequency of every keyword at an specific date.

Example 1 (pseudo code):

1st search where date=today:
web=>70
apple=>35
blue=>32

2nd search where date=yesterday:
web=>65
blue=>55
apple=>5

But now i would like to combine the results into one solr/lucene query in order to calculate which word-frequency grows very strong and witch doesn't. An result could be:

Example 2:

one search merging both querys from example 1
web=>(70,65)  <- growth +7,69%
blue=>(32,55) <- growth -41,81%
apple=>(34,5) <- growth +680%

Is it possible (and useful) to do this consolidation (and calclulation) inside solr or is it better to start 2 solr querys (see example 1) an postprocess the results with PHP?

Than you!

Was it helpful?

Solution

If you have the facet values a priori, you could do this with facet queries, i.e. something like facet.query=category:web AND date:[2011-06-14T00:00:00Z TO 2011-06-14T23:59:59Z]&facet.query=category:web AND date:[2011-06-13T00:00:00Z TO 2011-06-13T23:59:59Z]&... so you would do the cartesian product of facet values * dates.

Otherwise, to do this inside Solr I think you'd have to write some custom Java faceting code. Or do it client-side, with multiple queries as you mentioned.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top