org.apache.solr.search.DocListAndSet Java Examples
The following examples show how to use
org.apache.solr.search.DocListAndSet.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MoreLikeThisHandler.java From lucene-solr with Apache License 2.0 | 6 votes |
public DocListAndSet getMoreLikeThis( int id, int start, int rows, List<Query> filters, List<InterestingTerm> terms, int flags ) throws IOException { Document doc = reader.document(id); rawMLTQuery = mlt.like(id); boostedMLTQuery = getBoostedQuery( rawMLTQuery ); if( terms != null ) { fillInterestingTermsFromMLTQuery( boostedMLTQuery, terms ); } // exclude current document from results BooleanQuery.Builder realMLTQuery = new BooleanQuery.Builder(); realMLTQuery.add(boostedMLTQuery, BooleanClause.Occur.MUST); realMLTQuery.add( new TermQuery(new Term(uniqueKeyField.getName(), uniqueKeyField.getType().storedToIndexed(doc.getField(uniqueKeyField.getName())))), BooleanClause.Occur.MUST_NOT); this.realMLTQuery = realMLTQuery.build(); DocListAndSet results = new DocListAndSet(); if (this.needDocSet) { results = searcher.getDocListAndSet(this.realMLTQuery, filters, null, start, rows, flags); } else { results.docList = searcher.getDocList(this.realMLTQuery, filters, null, start, rows, flags); } return results; }
Example #2
Source File: MoreLikeThisHandler.java From lucene-solr with Apache License 2.0 | 5 votes |
public DocListAndSet getMoreLikeThis( Reader reader, int start, int rows, List<Query> filters, List<InterestingTerm> terms, int flags ) throws IOException { // SOLR-5351: if only check against a single field, use the reader directly. Otherwise we // repeat the stream's content for multiple fields so that query terms can be pulled from any // of those fields. String [] fields = mlt.getFieldNames(); if (fields.length == 1) { rawMLTQuery = mlt.like(fields[0], reader); } else { CharsRefBuilder buffered = new CharsRefBuilder(); char [] chunk = new char [1024]; int len; while ((len = reader.read(chunk)) >= 0) { buffered.append(chunk, 0, len); } Collection<Object> streamValue = Collections.singleton(buffered.get().toString()); Map<String, Collection<Object>> multifieldDoc = new HashMap<>(fields.length); for (String field : fields) { multifieldDoc.put(field, streamValue); } rawMLTQuery = mlt.like(multifieldDoc); } boostedMLTQuery = getBoostedQuery( rawMLTQuery ); if (terms != null) { fillInterestingTermsFromMLTQuery( boostedMLTQuery, terms ); } DocListAndSet results = new DocListAndSet(); if (this.needDocSet) { results = searcher.getDocListAndSet( boostedMLTQuery, filters, null, start, rows, flags); } else { results.docList = searcher.getDocList( boostedMLTQuery, filters, null, start, rows, flags); } return results; }
Example #3
Source File: ExampleResalePriceGroupingHandler.java From solr-autocomplete with Apache License 2.0 | 4 votes |
@Override public DocListAndSet postProcessResult(ResponseBuilder rb, DocList originalResult) { // no post processing needed return null; }
Example #4
Source File: ExampleResalePriceGroupingHandler.java From solr-autocomplete with Apache License 2.0 | 4 votes |
@Override public DocListAndSet postProcessDistributedResult(ResponseBuilder rb, SolrDocumentList originalResult) { // no post processing needed return null; }
Example #5
Source File: LocationGroupingHandler.java From solr-autocomplete with Apache License 2.0 | 4 votes |
@Override public DocListAndSet postProcessResult(ResponseBuilder rb, DocList originalResult) { // TODO Auto-generated method stub return null; }
Example #6
Source File: LocationGroupingHandler.java From solr-autocomplete with Apache License 2.0 | 4 votes |
@Override public DocListAndSet postProcessDistributedResult(ResponseBuilder rb, SolrDocumentList originalResult) { // TODO Auto-generated method stub return null; }
Example #7
Source File: ResponseBuilder.java From lucene-solr with Apache License 2.0 | 4 votes |
public DocListAndSet getResults() { return results; }
Example #8
Source File: ResponseBuilder.java From lucene-solr with Apache License 2.0 | 4 votes |
public void setResults(DocListAndSet results) { this.results = results; }
Example #9
Source File: GroupingHandler.java From solr-autocomplete with Apache License 2.0 | 2 votes |
/** * Can be used to adjust resulting set after the query for particular group was executed. If no changes are done, * the method should return null. * * @param rb . * @param originalResult . * @return new DocSlice result or null if no changes */ public abstract DocListAndSet postProcessResult(ResponseBuilder rb, DocList originalResult);
Example #10
Source File: GroupingHandler.java From solr-autocomplete with Apache License 2.0 | votes |
public abstract DocListAndSet postProcessDistributedResult(ResponseBuilder rb, SolrDocumentList originalResult);