Hello,

I have a field called timeSlot in my documents, basically representing an
hour.

When a query is made, I would like to make a graph of how many doc hits
corresponds to each timeSlot, sort it and display a chart of it.

I am simply using term queries, to query StringFields, and here is my
relevant search code:

            IndexSearcher searcher = new IndexSearcher(reader);
            TermQuery termQuery = new TermQuery(new Term(fieldName,
value.toString()));

            SortField sF = new SortField("beginTime", Type.LONG, true);
            Sort sort = new Sort(sF);

            results = searcher.search(termQuery, start + hitsPerPage,
sort);
            Integer numTotalHits = results.totalHits;
            ScoreDoc[] hits = results.scoreDocs;

...


How can I take advantage of Faceted searching in this scenario, to
facetCount field named timeSlot, simply?

I have looked over the example code at demo, which is using a taxonomy
reader/writer, but I could not figure out.

It appears we can consruct a FacetCollector, and provide it as an argument
to search like searcher.searc(query, 1000, facetCollector) - but then I
could not figure out how to get the facets and facet counts from that
collector.

I have done similar things in the past using solr, but I am stuck now.

Any ideas/help/recomendations greatly appreciated.

Best Regards,
C.B.

Reply via email to