저는 Solr 및 Broadleaf를 처음 사용하고 있습니다.넓은 범위의 solr 쿼리
저는 broadleaf에서 solr 검색을 사용하고 있습니다. 그것은 완벽하게 잘 작동하는 상태입니다. 제품 테이블에는 카테고리 필드와 카테고리별로 광역 검색이 있습니다. 요구 사항에 따라 회사 테이블이 확장되어 회사 ID가있는 새 테이블이 만들어 지므로 ExtendedProduct 테이블에는 companyId 및 productId (제품 테이블이있는 fk) 필드가 두 개 있습니다. Now 나는 회사에서 제품 목록을 얻고 싶습니다.
우리의 schema.xml 파일은
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5">
<fields>
<field name="namespace" type="string" indexed="true" stored="false" />
<field name="id" type="string" indexed="true" stored="true" />
<field name="productId" type="long" indexed="true" stored="true" />
<field name="category" type="long" indexed="true" stored="false" multiValued="true" />
<field name="explicitCategory" type="long" indexed="true" stored="false" multiValued="true" />
<field name="searchable" type="text_general" indexed="true" stored="false" />
<dynamicField name="*_searchable" type="text_general" indexed="true" stored="false" />
<dynamicField name="*_i" type="int" indexed="true" stored="false" />
<dynamicField name="*_is" type="int" indexed="true" stored="false" multiValued="true" />
<dynamicField name="*_s" type="string" indexed="true" stored="false" />
<dynamicField name="*_ss" type="string" indexed="true" stored="false" multiValued="true" />
<dynamicField name="*_l" type="long" indexed="true" stored="false" />
<dynamicField name="*_ls" type="long" indexed="true" stored="false" multiValued="true" />
<dynamicField name="*_t" type="text_general" indexed="true" stored="false" />
<dynamicField name="*_txt" type="text_general" indexed="true" stored="false" multiValued="true" />
<dynamicField name="*_b" type="boolean" indexed="true" stored="false" />
<dynamicField name="*_bs" type="boolean" indexed="true" stored="false" multiValued="true" />
<dynamicField name="*_d" type="double" indexed="true" stored="false" />
<dynamicField name="*_ds" type="double" indexed="true" stored="false" multiValued="true" />
<dynamicField name="*_p" type="double" indexed="true" stored="false" />
<dynamicField name="*_dt" type="date" indexed="true" stored="false" />
<dynamicField name="*_dts" type="date" indexed="true" stored="false" multiValued="true" />
<!-- some trie-coded dynamic fields for faster range queries -->
<dynamicField name="*_ti" type="tint" indexed="true" stored="false" />
<dynamicField name="*_tl" type="tlong" indexed="true" stored="false" />
<dynamicField name="*_td" type="tdouble" indexed="true" stored="false" />
<dynamicField name="*_tdt" type="tdate" indexed="true" stored="false" />
</fields>
<uniqueKey>id</uniqueKey>
<types>
<!-- The StrField type is not analyzed, but indexed/stored verbatim. -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<!-- boolean type: "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" />
<!-- Default numeric field types. For faster range queries, consider the
tint/tlong/tdouble types. -->
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0" />
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0" />
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0" />
<!-- Numeric field types that index each value at various levels of precision
to accelerate range queries when the number of values between the range endpoints
is large. See the javadoc for NumericRangeQuery for internal implementation
details. Smaller precisionStep values (specified in bits) will lead to more
tokens indexed per value, slightly larger index size, and faster range queries.
A precisionStep of 0 disables indexing at different precision levels. -->
<fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0" />
<fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0" />
<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0" />
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z,
and is a more restricted form of the canonical representation of dateTime
http://www.w3.org/TR/xmlschema-2/#dateTime The trailing "Z" designates UTC
time and is mandatory. Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
All other components are mandatory. Expressions can also be used to denote
calculations that should be performed relative to "NOW" to determine the
value, ie... NOW/HOUR ... Round to the start of the current hour NOW-1DAY
... Exactly 1 day prior to now NOW/DAY+6MONTHS+3DAYS ... 6 months and 3 days
in the future from the start of the current day Consult the DateField javadocs
for more information. Note: For faster range queries, consider the tdate
type -->
<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0" />
<!-- A Trie based date field for faster date range queries and date faceting. -->
<fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0" />
<!-- A general text field that has reasonable, generic cross-language defaults:
it tokenizes with StandardTokenizer and down cases. -->
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
</types>
</schema>
아래 보이는 그들이 범주에 대한 쿼리를 배치하는 잎이 넓은에서 지금
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<abortOnConfigurationError>${solr.abortOnConfigurationError:true} </abortOnConfigurationError>
<luceneMatchVersion>LUCENE_40</luceneMatchVersion>
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}" />
<updateHandler class="solr.DirectUpdateHandler2" />
<query>
<maxBooleanClauses>1024</maxBooleanClauses>
<filterCache class="solr.FastLRUCache" size="512" initialSize="512" autowarmCount="0" />
<queryResultCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0" />
<documentCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0" />
<enableLazyFieldLoading>true</enableLazyFieldLoading>
<queryResultWindowSize>20</queryResultWindowSize>
<queryResultMaxDocsCached>200</queryResultMaxDocsCached>
<listener event="newSearcher" class="solr.QuerySenderListener" />
<listener event="firstSearcher" class="solr.QuerySenderListener">
<arr name="queries">
<lst>
<str name="q">static firstSearcher warming in solrconfig.xml</str>
</lst>
</arr>
</listener>
<useColdSearcher>false</useColdSearcher>
<maxWarmingSearchers>2</maxWarmingSearchers>
</query>
<requestDispatcher>
<requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048000" />
<httpCaching never304="true" />
</requestDispatcher>
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">4</int>
<str name="df">name_t</str>
</lst>
</requestHandler>
<requestHandler name="/update" class="solr.UpdateRequestHandler" />
<requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
<requestHandler name="/update/json" class="solr.JsonUpdateRequestHandler" startup="lazy" />
<queryResponseWriter name="json" class="solr.JSONResponseWriter">
<str name="content-type">text/plain; charset=UTF-8</str>
</queryResponseWriter>
</config>
같은 solrConfig.xml 파일을 찾습니다 : 2023. 아래에있는 SolrQuery.toString이 Q 같습니다 = 카테고리 % 3A2003 & FL = ID & 행 15 & FQ = 네임 스페이스 % 3Ad는 0이 테이블 이름 난 여전히 찾을 수 없습니다
=입니다
어디에서 어떻게 시작/& = 이것으로 구성됩니다.회사에서 제품을 찾고 싶습니다.이 변경을해야합니까? 사전에
감사합니다,이에 대한 주요 문서 링크가 http://docs.broadleafcommerce.org/current/Catalog-and-Search.html에있다 ANKIT
안녕 phillipuniverse, 답장을 보내 감사 : 프로젝트에서 load_catalog_data.sql에서, 이것은 '제조업체'필드에 검색 할 가져 오는 방법이다. 지금 나는 companyId 에 대한 shema.xml에 새 항목을 넣었습니다. 그리고 이것을 서버가 시작될 때 solr 인덱스에 저장합니다. 그 우리는 요구 사항에 따라 또한 관리자의 상황을 타개 할, 우리는 사이트에 확장하여 상황을 타개 수 있듯이 .. 지금은 잘 작동? 은 지금은 내가 그렇게 할 수있는 방법, 내가 코드에 의해 약간의 흐름을 추적하려는 경우, 관리자에 대한 코드를 제공하지 않습니다 잎이 넓은 3.0 작업 공간 및 데모 사이트를 사용하고? –
Ankit