Examples of SearchContext


Examples of org.elasticsearch.search.internal.SearchContext

        if (ids.size() == 0) {
            throw new QueryParsingException(parseContext.index(), "[ids] query, no ids values provided");
        }

        if (types == null || types.isEmpty()) {
            SearchContext searchContext = SearchContext.current();
            if (searchContext.hasTypes()) {
                types = Arrays.asList(searchContext.types());
            } else {
                types = parseContext.mapperService().types();
            }
        } else if (types.size() == 1 && Iterables.getFirst(types, null).equals("_all")) {
            types = parseContext.mapperService().types();
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext

        String parentType = childDocMapper.parentFieldMapper().type();

        // wrap the query with type query
        query = new FilteredQuery(query, parseContext.cacheFilter(childDocMapper.typeFilter(), null));

        SearchContext searchContext = SearchContext.current();

        HasChildFilter childFilter = new HasChildFilter(query, scope, childType, parentType, searchContext);
        searchContext.addScopePhase(childFilter);

        if (filterName != null) {
            parseContext.addNamedFilter(filterName, childFilter);
        }
        return childFilter;
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext

        new MatchQueryBuilder(null, cache, null, options);
    }

    @Test
    public void testSimpleSingleMatchSingleTerm() throws Exception {
        SearchContext searchContext = mockSearchContext();
        Map<String, Object> fields = MapBuilder.<String, Object>newMapBuilder().put("col1", null).map();
        MatchQueryBuilder builder = new MatchQueryBuilder(searchContext, cache, null, Collections.emptyMap());
        Query query = builder.query(fields, new BytesRef("foo"));
        assertThat(query, instanceOf(TermQuery.class));
    }
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext

        assertThat(query, instanceOf(TermQuery.class));
    }

    @Test
    public void testSimpleSingleMatchTwoTerms() throws Exception {
        SearchContext searchContext = mockSearchContext();
        Map<String, Object> fields = MapBuilder.<String, Object>newMapBuilder().put("col1", null).map();
        MatchQueryBuilder builder = new MatchQueryBuilder(searchContext, cache, null, Collections.emptyMap());
        Query query = builder.query(fields, new BytesRef("foo bar"));
        assertThat(query, instanceOf(BooleanQuery.class));
    }
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext

        assertThat(query, instanceOf(BooleanQuery.class));
    }

    @Test
    public void testSingleFieldWithCutFrequency() throws Exception {
        SearchContext searchContext = mockSearchContext();
        MatchQueryBuilder builder = new MatchQueryBuilder(
                searchContext, cache, null, newMapBuilder().put("cutoff_frequency", 3).map());

        Map<String, Object> fields = MapBuilder.<String, Object>newMapBuilder().put("col1", null).map();
        Query query = builder.query(fields, new BytesRef("foo bar"));
View Full Code Here

Examples of org.elasticsearch.search.internal.SearchContext

    }

    @Test
    public void testCrossFieldMatchType() throws Exception {
        Analyzer analyzer = new GermanAnalyzer(Version.LUCENE_4_9);
        SearchContext searchContext = mock(SearchContext.class);
        MapperService.SmartNameFieldMappers smartNameFieldMappers = mock(MapperService.SmartNameFieldMappers.class);
        when(searchContext.smartFieldMappers(anyString())).thenReturn(smartNameFieldMappers);
        when(smartNameFieldMappers.hasMapper()).thenReturn(true);
        FieldMapper fieldMapper = mock(FieldMapper.class, Answers.RETURNS_MOCKS.get());
        when(smartNameFieldMappers.mapper()).thenReturn(fieldMapper);
        when(fieldMapper.searchAnalyzer()).thenReturn(analyzer);

        MapperService mapperService = mock(MapperService.class);
        when(searchContext.mapperService()).thenReturn(mapperService);
        when(mapperService.searchAnalyzer()).thenReturn(analyzer);

        MatchQueryBuilder builder = new io.crate.lucene.match.MultiMatchQueryBuilder(
                searchContext, cache, new BytesRef("cross_fields"), Collections.emptyMap());
        Map<String, Object> fields = MapBuilder.<String, Object>newMapBuilder()
View Full Code Here

Examples of org.fife.ui.rtextarea.SearchContext

        boolean caseSensitive = matchCaseCB.isSelected();
        boolean regExpr = regexCB.isSelected();
        boolean forwardSearch = forward;
        boolean wholeWord = false;
       
        SearchContext context = new SearchContext();
        if (text.length() ==0)
            return;
        context.setSearchFor(text);
        context.setMatchCase(matchCaseCB.isSelected());
        context.setRegularExpression(regexCB.isSelected());
        context.setSearchForward(forward);
        context.setWholeWord(false);
       
        boolean found = SearchEngine.find(jep, context);

        if (!found)
            JOptionPane.showMessageDialog(this.currentFrame, "Text not found");
View Full Code Here

Examples of org.fife.ui.rtextarea.SearchContext

      rTextArea.markAll(searchText, matchCase, wholeWord, regex);
    } else {
      rTextArea.clearMarkAllHighlights();
    }

    SearchContext context = new SearchContext();
    context.setSearchFor(searchText);
    context.setMatchCase(matchCase);
    context.setRegularExpression(regex);
    context.setSearchForward(forward);
    context.setWholeWord(wholeWord);

    // TODO hack: move cursor before previous search for not jump to next occurrence
    if (direction == 0 && !COLOR_BG_ERROR.equals(searchField.getBackground())) {
      try {
        int caretPos = rTextArea.getCaretPosition();
View Full Code Here

Examples of org.fife.ui.rtextarea.SearchContext

      RSyntaxTextArea pane = mainWindow.getModel().getCurrentTextArea();
      if (pane == null)
        return;

      SearchContext context = new SearchContext();
      context.setSearchFor(textField.getText());
      context.setMatchCase(mcase.isSelected());
      context.setRegularExpression(regex.isSelected());
      context.setSearchForward(!reverse.isSelected());
      context.setWholeWord(wholew.isSelected());

      if (!SearchEngine.find(pane, context).wasFound()) {
        pane.setSelectionStart(0);
        pane.setSelectionEnd(0);
      }
View Full Code Here

Examples of org.fife.ui.rtextarea.SearchContext

        }

        String searchExpression = findCombo.getSelectedItem().toString();
        String replacement = replaceCombo.getSelectedItem().toString();

        SearchContext context = new SearchContext();
        context.setSearchFor(searchExpression);
        context.setReplaceWith(replacement);
        context.setRegularExpression(false);
        context.setSearchForward(forwardButton.isSelected());
        context.setWholeWord(wholeWordCheck.isSelected());
        context.setMatchCase(caseCheck.isSelected());
        return context;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.