Package com.flaptor.indextank.query

Examples of com.flaptor.indextank.query.Query


        sleep(100);
        new Thread(new RunSearch(sleepSearcher)).start();
        sleep(100);
        // now start one that should throw an exception because the queue is at max length
        try {
            final Query query = new Query(new TermQuery("text", "nada"), null, null);
            sleepSearcher.search(query, 0, 10, 0);
            fail("Should have thrown InterruptedException");
        } catch (InterruptedException e) {
            System.out.println("InterruptedException thrown, success");
        }
View Full Code Here


    @TestInfo(testType=UNIT)
    public void testNonConcurrentSearching() throws InterruptedException {
        // make sure serial searches don't cause an InterruptedException
        for (int i = 0; i < 100; i++) {
            final Query query = new Query(new TermQuery("text", "nada"), null, null);
            fastSearcher.search(query, 0, 10, 0);
        }
    }
View Full Code Here

        }

        @Override
        public void run() {
            try {
                final Query query = new Query(new TermQuery("text","hola"),null,null);
                searcher.search(query, 0, 10, 0);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
View Full Code Here

    public void testSwitch() throws IOException, ParseException, InterruptedException {
      indexTwelveDocs(this.indexEngine.getIndexer());

        DocumentSearcher searcher = this.indexEngine.getSearcher();

        SearchResults srs = searcher.search(new Query(new TermQuery("text","term1"),null,null),0,10, 0);
    assertEquals("Number of historic results doesn't match", 1, srs.getMatches());
       
        srs = searcher.search(new Query(new TermQuery("text","term11"),null,null),0,10, 0);
    assertEquals("Number of real time results doesn't match", 1, srs.getMatches());

        Query query = new Query(this.indexEngine.getParser().parseQuery("term1 OR term2 OR term3 OR term4 OR term5"),null,null);
        srs = searcher.search(query,0,10, 0);
    assertEquals("Number of real time results doesn't match", 5, srs.getMatches());
  }
View Full Code Here

    @TestInfo(testType=SYSTEM)
    public void testSwitchedDuplicates() throws IOException, ParseException, InterruptedException {
      indexLengthDifferentDocs(this.indexEngine.getIndexer(), 33, 1);
      indexLengthDifferentDocs(this.indexEngine.getIndexer(), 33, 2);
     
      Query query = new Query(this.indexEngine.getParser().parseQuery("foo"),null,null);
      SearchResults srs = this.indexEngine.getSearcher().search(query,0,100, 0);
     
     
      assertEquals("Number of results doesn't match", 33, srs.getMatches());
      Multiset<String> ids = HashMultiset.create();
View Full Code Here

      assertEquals("Number of actual results doesn't match", 33, ids.size());
      assertEquals("Number of different results doesn't match", 33, ids.elementSet().size());
    }
   
    private void checkResults(DocumentSearcher searcher, int start, int len, int[] expectedIds) throws InterruptedException {
        SearchResults srs = searcher.search(new Query(new TermQuery("text","fixed"),"fixed",null),start,len, 0);
        Set<Integer> expIds = Sets.newHashSet();
        for (int i : expectedIds) {
            expIds.add(i);
        }
        int n = 0;
View Full Code Here

            List<RangeFilter> variableRangeFilters,
            List<RangeFilter> functionRangeFilters,
            Map<String,String> extraParameters) throws IndexEngineApiException {
        DocumentSearcher searcher = engine.getSearcher();
        try {
            Query query = generateQuery(queryStr, start, len,
                    QueryVariablesImpl.fromMap(queryVariables),
                    convertToMultimap(facetsFilter),
                    new IntersectionMatchFilter(
                            convertToVariableRangeFilter(variableRangeFilters),
                            convertToFunctionRangeFilter(functionRangeFilters)
View Full Code Here

        return new FunctionRangeFilter(scorer, dynamicDataManager, filters);
    }

    private Query generateQuery(String str, int start, int len, QueryVariables vars, Multimap<String, String> facetsFilter, MatchFilter rangeFilters) throws ParseException {
        IndexEngineParser parser = engine.getParser();
        return new Query(parser.parseQuery(str), str, vars, facetsFilter, rangeFilters);
    }
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.query.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.