Package org.apache.solr.client.solrj

Examples of org.apache.solr.client.solrj.SolrQuery.addFilterQuery()


                    query.setRows(0);
                    query.addFilterQuery(this.field + ":*");
                    if (layerName != null && layerName.isEmpty()) {
                        query.addFilterQuery(name + ":" + layerName);
                    } else {
                        query.addFilterQuery(name + ":*");
                    }
                    QueryResponse rsp = solrServer.query(query);
                    long founds = rsp.getResults().getNumFound();

                    FieldTypeInfo fty = processSchema.getFieldTypeInfo(type);
View Full Code Here


    private SolrQuery initSolrQuery(Query entityhubQuery) {
        SolrQuery query = new SolrQuery();
        // first add a filterquery for the domain if present
        if (domain != null) {
            query.addFilterQuery(String.format("%s:%s", fieldMapper.getDocumentDomainField(),
                SolrUtil.escapeSolrSpecialChars(domain)));
        }
        // than add the offset
        query.setStart(entityhubQuery.getOffset());
        // and the limit
View Full Code Here

                for (Entry<String,List<Object>> entry : constraints.entrySet()) {
                    String fieldName = ClientUtils.escapeQueryChars(entry.getKey());
                    String type = getFacetFieldType(fieldName, allAvailableFacets);
                    for (Object value : entry.getValue()) {
                        if (SolrVocabulary.isRangeType(type)) {
                            query.addFilterQuery(fieldName + facetDelimiter + (String) value);
                        } else {
                            query.addFilterQuery(fieldName + facetDelimiter + quotation
                                                 + ClientUtils.escapeQueryChars((String) value) + quotation);
                        }
                    }
View Full Code Here

                    String type = getFacetFieldType(fieldName, allAvailableFacets);
                    for (Object value : entry.getValue()) {
                        if (SolrVocabulary.isRangeType(type)) {
                            query.addFilterQuery(fieldName + facetDelimiter + (String) value);
                        } else {
                            query.addFilterQuery(fieldName + facetDelimiter + quotation
                                                 + ClientUtils.escapeQueryChars((String) value) + quotation);
                        }
                    }
                }
            } catch (Exception e) {
View Full Code Here

        if (broaderField == null) {
            return narrowerConcepts;
        }
        SolrServer solrServer = getActiveSolrServer();
        SolrQuery query = new SolrQuery(entryTypeField + ":" + METADATA_ENTRY);
        query.addFilterQuery(broaderField + ":" + ClientUtils.escapeQueryChars(broadTopicId));
        query.addField(conceptUriField);
        query.addSortField(conceptUriField, SolrQuery.ORDER.asc);
        try {
            for (SolrDocument result : solrServer.query(query).getResults()) {
                narrowerConcepts.add(result.getFirstValue(conceptUriField).toString());
View Full Code Here

        } else {
            q.setFields(Server.Schema.ID.toString());
        }
       
        for (KeywordQueryFilter filter : filters) {
            q.addFilterQuery(filter.toString());
        }
       
        if (snippets) {
            q.addHighlightField(Server.Schema.TEXT.toString());
            //q.setHighlightSimplePre("&laquo;"); //original highlighter only
View Full Code Here

            contentIDStr = Server.getChunkIdString(contentID, chunkID);
        }

        String idQuery = Server.Schema.ID.toString() + ":" + contentIDStr;
        q.setShowDebugInfo(DEBUG); //debug
        q.addFilterQuery(idQuery);
        q.addHighlightField(highlightField);
        //q.setHighlightSimplePre("&laquo;"); //original highlighter only
        //q.setHighlightSimplePost("&raquo;");  //original highlighter only
        q.setHighlightSnippets(1);
        q.setHighlightFragsize(SNIPPET_LENGTH);
View Full Code Here

            q.setQuery("*:*");
            String filterQuery = Schema.ID.toString() + ":" + contentID;
            if (chunkID != 0) {
                filterQuery = filterQuery + Server.ID_CHUNK_SEP + chunkID;
            }
            q.addFilterQuery(filterQuery);
            q.setFields(Schema.TEXT.toString());
            try {
                // @@@ BC Make this more robust -> using get(1) bcause 0 is the file name in the multivalued output.
                ArrayList<String> values = (ArrayList<String>)solrCore.query(q).getResults().get(0).getFieldValue(Schema.TEXT.toString());
                return values.get(1);
View Full Code Here

         * @return true if it is indexed
         * @throws SolrServerException
         */
        private boolean queryIsIndexed(long contentID) throws SolrServerException {
            SolrQuery q = new SolrQuery("*:*");
            q.addFilterQuery(Server.Schema.ID.toString() + ":" + Long.toString(contentID));
            //q.setFields(Server.Schema.ID.toString());
            q.setRows(0);
            return (int) query(q).getResults().getNumFound() != 0;
        }

View Full Code Here

            contentIdStr += "_" + Integer.toString(this.currentPage);
        }


        final String filterQuery = Server.Schema.ID.toString() + ":" + contentIdStr;
        q.addFilterQuery(filterQuery);
        q.addHighlightField(highLightField); //for exact highlighting, try content_ws field (with stored="true" in Solr schema)

        //q.setHighlightSimplePre(HIGHLIGHT_PRE); //original highlighter only
        //q.setHighlightSimplePost(HIGHLIGHT_POST); //original highlighter only
        q.setHighlightFragsize(0); // don't fragment the highlight, works with original highlighter, or needs "single" list builder with FVH
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.