Lucene.Net.Search.SimpleFacetedSearch.Search C# (CSharp) Method

Search() public method

public Search ( Query query ) : Lucene.Net.Search.Hits
query Query
return Lucene.Net.Search.Hits
        public Hits Search(Query query)
        {
            return Search(query, DefaultMaxDocPerGroup);
        }

Same methods

SimpleFacetedSearch::Search ( Query query, int maxDocPerGroup ) : Lucene.Net.Search.Hits

Usage Example

        /// <summary>
        /// *****************************************************
        /// * SAMPLE USAGE                                      *
        /// *****************************************************
        /// </summary>
        void HowToUse(string searchString)
        {
            Query query = new QueryParser(Lucene.Net.Util.Version.LUCENE_29, "text", new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)).Parse(searchString);

            SimpleFacetedSearch sfs = new SimpleFacetedSearch(_Reader, new string[] { "source", "category" });

            SimpleFacetedSearch.Hits hits = sfs.Search(query, 10);

            long totalHits = hits.TotalHitCount;

            foreach (SimpleFacetedSearch.HitsPerFacet hpg in hits.HitsPerFacet)
            {
                long hitCountPerGroup = hpg.HitCount;
                SimpleFacetedSearch.FacetName facetName = hpg.Name;
                for (int i = 0; i < facetName.Length; i++)
                {
                    string part = facetName[i];
                }
                foreach (Document doc in hpg.Documents)
                {
                    string text = doc.GetField("text").StringValue;
                    System.Diagnostics.Debug.WriteLine(">>" + facetName + ": " + text);
                }
            }
        }
All Usage Examples Of Lucene.Net.Search.SimpleFacetedSearch::Search