ToString() 공개 메소드

Prints a user-readable version of this query.
public ToString ( System f ) : System.String
f System
리턴 System.String
예제 #1
0
        public virtual void TestToString()
        {
            PhraseQuery q = new PhraseQuery(); // Query "this hi this is a test is"

            q.Add(new Term("field", "hi"), 1);
            q.Add(new Term("field", "test"), 5);

            Assert.AreEqual(q.ToString(), "field:\"? hi ? ? ? test\"");
            q.Add(new Term("field", "hello"), 1);
            Assert.AreEqual(q.ToString(), "field:\"? hi|hello ? ? ? test\"");
        }
예제 #2
0
        public virtual void  TestToString()
        {
            StopAnalyzer analyzer = new StopAnalyzer(Util.Version.LUCENE_CURRENT);
            QueryParser  qp       = new QueryParser(Util.Version.LUCENE_CURRENT, "field", analyzer);

            qp.EnablePositionIncrements = true;
            PhraseQuery q = (PhraseQuery)qp.Parse("\"this hi this is a test is\"");

            Assert.AreEqual("field:\"? hi ? ? ? test\"", q.ToString());
            q.Add(new Term("field", "hello"), 1);
            Assert.AreEqual("field:\"? hi|hello ? ? ? test\"", q.ToString());
        }
예제 #3
0
        public virtual void  TestToString()
        {
            StopAnalyzer analyzer = new StopAnalyzer();

            StopFilter.SetEnablePositionIncrementsDefault(true);
            QueryParser qp = new QueryParser("field", analyzer);

            qp.SetEnablePositionIncrements(true);
            PhraseQuery q = (PhraseQuery)qp.Parse("\"this hi this is a test is\"");

            Assert.AreEqual("field:\"? hi ? ? ? test\"", q.ToString());
            q.Add(new Term("field", "hello"), 1);
            Assert.AreEqual("field:\"? hi|hello ? ? ? test\"", q.ToString());
        }
        public string GetSearchQuery(params ISearchableMetadataValue[] searchableMetadataValues)
        {
            var query = new PhraseQuery();

            foreach (var searchableMetadataValue in searchableMetadataValues)
            {
                query.Add(new Term(searchableMetadataValue.Metadata.SearchName, searchableMetadataValue.Value));
            }

            var filter = query.ToString();

            return GetSearchQuery(filter, new SearchableMetadata[] { });
        }
예제 #5
0
        public virtual void TestToString()
        {
            PhraseQuery q = new PhraseQuery(); // Query "this hi this is a test is"
            q.Add(new Term("field", "hi"), 1);
            q.Add(new Term("field", "test"), 5);

            Assert.AreEqual(q.ToString(), "field:\"? hi ? ? ? test\"");
            q.Add(new Term("field", "hello"), 1);
            Assert.AreEqual(q.ToString(), "field:\"? hi|hello ? ? ? test\"");
        }