/** * Removes the given filter queries, if already set and then adds the filter queries again.<p> * * @param fqs the filter queries to remove */ private void replaceFilterQueries(String[] fqs) { removeFilterQueries(fqs); addFilterQuery(fqs); } }
/** * Updates the core name to be in sync with the index name. */ private void updateCoreName() { m_coreName = generateCoreName(getName()); }
/** * Sets the return fields 'fl' to a predefined set that does not contain content specific fields.<p> * * @param structureQuery the <code>true</code> to return only structural fields */ public void setStructureQuery(boolean structureQuery) { if (structureQuery) { setFields(STRUCTURE_FIELDS); } }
/** * Performs a search.<p> * * @param cms the cms object * @param solrQuery the Solr query * * @return a list of documents * * @throws CmsSearchException if something goes wrong * * @see #search(CmsObject, CmsSolrQuery, boolean) */ public CmsSolrResultList search(CmsObject cms, String solrQuery) throws CmsSearchException { return search(cms, new CmsSolrQuery(null, CmsRequestUtil.createParameterMap(solrQuery)), false); }
/** * @see java.lang.Object#clone() */ @Override public CmsSolrQuery clone() { CmsSolrQuery sq = new CmsSolrQuery(null, CmsRequestUtil.createParameterMap(toString())); sq.m_ignoreExpiration = m_ignoreExpiration; return sq; }
/** * Default search method.<p> * * @param cms the current CMS object * @param query the query * * @return the results * * @throws CmsSearchException if something goes wrong * * @see #search(CmsObject, String) */ public CmsSolrResultList search(CmsObject cms, CmsSolrQuery query) throws CmsSearchException { return search(cms, query, false); }
/** * Sets the resource types only if not set in the query parameters.<p> * * @param resourceTypes the resourceTypes to set */ public void setResourceTypes(String... resourceTypes) { setResourceTypes(Arrays.asList(resourceTypes)); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return getFieldValueAsString(CmsSearchField.FIELD_PATH); } }
/** * Returns the raw text content of a VFS resource of type <code>CmsResourceTypeContainerPage</code>.<p> * * @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, CmsSearchIndex) */ @Override public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsException { return extractContent(cms, resource, index, null); }
/** * @see org.opencms.jsp.search.result.I_CmsSearchResultWrapper#getHighlighting() */ @Override public Map<String, Map<String, List<String>>> getHighlighting() { return m_solrResultList == null ? null : m_solrResultList.getHighLighting(); }
/** * Sets the textSearchFields.<p> * * @param textSearchFields the textSearchFields to set */ public void setTextSearchFields(List<String> textSearchFields) { m_textSearchFields = textSearchFields; if (m_text != null) { setText(m_text); } }
/** * @see org.opencms.jsp.search.result.I_CmsSearchResultWrapper#getFieldFacets() */ @Override public Collection<FacetField> getFieldFacets() { return m_solrResultList == null ? null : m_solrResultList.getFacetFields(); }
/** * Returns the configured Solr home directory <code>null</code> if not set.<p> * * @return the Solr home directory */ public String getDirectorySolr() { return m_solrConfig != null ? m_solrConfig.getHome() : null; }
/** * @see org.opencms.search.CmsSearchIndex#createIndexWriter(boolean, org.opencms.report.I_CmsReport) */ @Override public I_CmsIndexWriter createIndexWriter(boolean create, I_CmsReport report) { return new CmsSolrIndexWriter(m_solr, this); }
/** * Extracts the content of a single XML content resource.<p> * * @param cms the cms context * @param resource the resource * @param index the used index * * @return the extraction result * * @throws CmsException in case reading or unmarshalling the content fails */ public static CmsExtractionResult extractXmlContent(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsException { return extractXmlContent(cms, resource, index, null); }
/** * Sets the search roots only if not set as query parameter.<p> * * @param searchRoots the searchRoots to set */ public void setSearchRoots(List<String> searchRoots) { if ((searchRoots != null) && !searchRoots.isEmpty()) { addFilterQuery(CmsSearchField.FIELD_PARENT_FOLDERS, searchRoots, false, true); } }
/** * Sets the textSearchFields.<p> * * @param textSearchFields the textSearchFields to set */ public void setTextSearchFields(String... textSearchFields) { setTextSearchFields(Arrays.asList(textSearchFields)); }
/** * Sets the logical key/name of this search index.<p> * * @param name the logical key/name of this search index * * @throws CmsIllegalArgumentException if the given name is null, empty or already taken by another search index */ @Override public void setName(String name) throws CmsIllegalArgumentException { super.setName(name); updateCoreName(); }
/** * @see org.opencms.search.I_CmsSearchDocument#getPath() */ public String getPath() { return getFieldValueAsString(CmsSearchField.FIELD_PATH); }
/** * @see org.opencms.search.I_CmsSearchDocument#getType() */ public String getType() { return getFieldValueAsString(CmsSearchField.FIELD_TYPE); }