Package com.flaptor.indextank.search

Examples of com.flaptor.indextank.search.DocumentSearcher


                                               indexCode,
                                               environment,
                                               configuration);

            BoostingIndexer indexer = ie.getIndexer();
            DocumentSearcher searcher = ie.getSearcher();
            Suggestor suggestor = ie.getSuggestor();
            DocumentStorage storage = ie.getStorage();


            if (line.hasOption("snippets")) {
View Full Code Here


 
    @TestInfo(testType=SYSTEM)
    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 testPagination() throws IOException, ParseException, InterruptedException {
      indexTwelveDocs(this.indexEngine.getIndexer());
        DocumentSearcher searcher = this.indexEngine.getSearcher();
        checkResults(searcher,0,5,new int[]{0,1,2,3,4});
        checkResults(searcher,5,5,new int[]{5,6,7,8,9});
        checkResults(searcher,10,5,new int[]{10,11});
    }
View Full Code Here

    }

    @TestInfo(testType=SYSTEM)
    public void testPromotion() throws IOException, ParseException,InterruptedException {
      indexTwelveDocs(this.indexEngine.getIndexer());
        DocumentSearcher searcher = this.indexEngine.getSearcher();
        BoostingIndexer indexer = this.indexEngine.getIndexer();
        indexer.promoteResult("doc_6", "fixed");
        checkResults(searcher,0,1,new int[]{6});
        checkResults(searcher,0,5,new int[]{0,1,2,3,6});
        checkResults(searcher,5,5,new int[]{4,5,7,8,9});
View Full Code Here

    }
   
    @TestInfo(testType=SYSTEM)
    public void testFacetedSearch() throws InterruptedException {
      indexForwardFacetedToDocuments(this.indexEngine.getIndexer());
        DocumentSearcher searcher = this.indexEngine.getSearcher();
       
        SearchResults searchResults = searcher.search(new Query(new TermQuery("text","a"),"a",null), 0, 10, 0);
       
        Map<String, Multiset<String>> facets = searchResults.getFacets();
       
        //System.out.println("Matches: " + searchResults.getMatches());
        //System.out.println(facets);
       
        assertEquals(2, facets.keySet().size());
       
        Multiset<String> precioFacet = facets.get("PRECIO");
    
        assertEquals(2, precioFacet.elementSet().size());
        assertEquals(2, precioFacet.count("ALTO"));
        assertEquals(3, precioFacet.count("BAJO"));
       
        Multiset<String> tipoFacet = facets.get("TIPO");
       
        assertEquals(2, tipoFacet.elementSet().size());
        assertEquals(3, tipoFacet.count("NAH"));
        assertEquals(2, tipoFacet.count("SI"));
       
       
        searchResults = searcher.search(new Query(new TermQuery("text","b"),"b",null), 0, 10, 0);
       
        facets = searchResults.getFacets();
       
        //System.out.println("Matches: " + searchResults.getMatches());
        //System.out.println(facets);
View Full Code Here

    }
   
    @TestInfo(testType=SYSTEM)
    public void testBackwardsFacetedSearch() throws InterruptedException {
      indexBackwardsFacetedToDocuments(this.indexEngine.getIndexer());
        DocumentSearcher searcher = this.indexEngine.getSearcher();
       
        SearchResults searchResults = searcher.search(new Query(new TermQuery("text","a"),"a",null), 0, 10, 0);
       
        Map<String, Multiset<String>> facets = searchResults.getFacets();
       
        //System.out.println("Matches: " + searchResults.getMatches());
        //System.out.println(facets);
       
        assertEquals(2, facets.keySet().size());
       
        Multiset<String> precioFacet = facets.get("PRECIO");
    
        assertEquals(2, precioFacet.elementSet().size());
        assertEquals(2, precioFacet.count("ALTO"));
        assertEquals(3, precioFacet.count("BAJO"));
       
        Multiset<String> tipoFacet = facets.get("TIPO");
       
        assertEquals(2, tipoFacet.elementSet().size());
        assertEquals(3, tipoFacet.count("NAH"));
        assertEquals(2, tipoFacet.count("SI"));
       
       
        searchResults = searcher.search(new Query(new TermQuery("text","b"),"b",null), 0, 10, 0);
       
        facets = searchResults.getFacets();
       
        //System.out.println("Matches: " + searchResults.getMatches());
        //System.out.println(facets);
View Full Code Here

  }

    @TestInfo(testType=SYSTEM)
    public void testFacetFiltering() throws InterruptedException, ParseException {
      indexBackwardsFacetedToDocuments(this.indexEngine.getIndexer());
        DocumentSearcher searcher = this.indexEngine.getSearcher();
       
        Multimap<String, String> categoriesFilter = HashMultimap.create();
       
        categoriesFilter.put("PRECIO", "BAJO");
       
    SearchResults searchResults = searcher.search(new Query(indexEngine.getParser().parseQuery("a OR b"),"a OR b", null, categoriesFilter, VariablesRangeFilter.NO_FILTER), 0, 10, 0);
   
    int matches = searchResults.getMatches();
    Map<String, Multiset<String>> facets = searchResults.getFacets();
    //System.out.println(matches);
    //System.out.println(searchResults.getResults());
    //System.out.println(searchResults.getFacets());
   
    assertEquals(4, matches);
    checkSearchResults(searchResults.getResults(), new String[] {"D6", "D5", "D2", "D1"});
   
    categoriesFilter = HashMultimap.create();
   
    categoriesFilter.put("TIPO", "NAH");
    categoriesFilter.put("TIPO", "TERCERO");
   
    searchResults = searcher.search(new Query(indexEngine.getParser().parseQuery("a OR b"),"a OR b", null, categoriesFilter, VariablesRangeFilter.NO_FILTER), 0, 10, 0);
   
    matches = searchResults.getMatches();
    //System.out.println(matches);
    //System.out.println(searchResults.getResults());
    //System.out.println(searchResults.getFacets());

    assertEquals(5, matches);
    checkSearchResults(searchResults.getResults(), new String[] {"D8", "D7", "D5", "D3", "D1"});

    categoriesFilter = HashMultimap.create();
   
    categoriesFilter.put("TIPO", "NAH");
    categoriesFilter.put("TIPO", "TERCERO");
    categoriesFilter.put("PRECIO", "BAJO");
   
    searchResults = searcher.search(new Query(indexEngine.getParser().parseQuery("a OR b"),"a OR b", null, categoriesFilter, VariablesRangeFilter.NO_FILTER), 0, 10, 0);
   
    matches = searchResults.getMatches();
    //System.out.println(matches);
    //System.out.println(searchResults.getResults());
    //System.out.println(searchResults.getFacets());
View Full Code Here

        }
    }

    @TestInfo(testType=SYSTEM)
    public void testRelevanceOrder() throws Exception {
        DocumentSearcher searcher = this.indexEngine.getSearcher();
        BoostingIndexer indexer = this.indexEngine.getIndexer();
        indexer.addScoreFunction(1, "relevance");

        Document doc = new Document(ImmutableMap.of("relevance_test", "Twinkle twinkle you better work"));
        indexer.add("1", doc, 0, ImmutableMap.<Integer, Double>of());
View Full Code Here

    }
   

    @TestInfo(testType=SYSTEM)
    public void testCaretQueries() throws InterruptedException, ParseException, Exception {
        DocumentSearcher searcher = this.indexEngine.getSearcher();
        BoostingIndexer indexer = this.indexEngine.getIndexer();
        indexer.addScoreFunction(1, "relevance");
        Document doc;
        Query query;
View Full Code Here

                                               indexCode,
                                               environment,
                                               configuration);

            BoostingIndexer indexer = ie.getIndexer();
            DocumentSearcher searcher = ie.getSearcher();
            Suggestor suggestor = ie.getSuggestor();
            DocumentStorage storage = ie.getStorage();

            if (line.hasOption("snippets")) {
              indexer = new DocumentStoringIndexer(indexer, storage);
View Full Code Here

TOP

Related Classes of com.flaptor.indextank.search.DocumentSearcher

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.