2014-12-04 4 views
0

레코드를 가져 오는 데 다음 쿼리를 사용하고 있지만 위양성 결과를 가져 오는 중입니다.쿼리가 거짓 긍적으로 반환 됨

<cts:and-query xmlns:cts="http://marklogic.com/cts"> 
    <cts:or-query> 
     <cts:element-value-query> 
     <cts:element>type</cts:element> 
     <cts:text xml:lang="en">article</cts:text> 
     </cts:element-value-query> 
    </cts:or-query> 
    <cts:element-query> 
     <cts:element>body</cts:element> 
     <cts:word-query> 
     <cts:text xml:lang="en">ace???</cts:text> 
     <cts:option>case-insensitive</cts:option> 
     <cts:option>diacritic-insensitive</cts:option> 
     <cts:option>punctuation-insensitive</cts:option> 
     <cts:option>whitespace-insensitive</cts:option> 
     <cts:option>stemmed</cts:option> 
     <cts:option>wildcarded</cts:option> 
     </cts:word-query> 
    </cts:element-query> 
    <cts:or-query> 
     <cts:element-range-query operator="&gt;="> 
     <cts:element>expires-on</cts:element> 
     <cts:value xsi:type="xs:dateTime" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">2014-12-04T06:05:29.78Z</cts:value> 
     </cts:element-range-query> 
     <cts:not-query> 
    <cts:element-value-query> 
     <cts:element>expires-on</cts:element> 
     <cts:text xml:lang="en">*</cts:text> 
     <cts:option>wildcarded</cts:option> 
    </cts:element-value-query> 
     </cts:not-query> 
    </cts:or-query> 
    </cts:and-query> 
</results> 

위 쿼리는 와일드 카드 쿼리로 "ace"에서 시작하는 6 자 단어를 검색해야합니다. 그러나 "에이스"에서 시작하는 6 자 이상의 단어를 포함하는 결과도 얻고 있습니다. 다음

우리가

  1. 단어가
  2. 빠른 구문 검색
  3. 단어의 위치를 ​​검색
  4. 빠른 대소 문자 구분 검색
  5. 빠른 분음 부호를 구분 검색
  6. 빠른 요소의 단어를 사용하는 인덱스입니다 검색
  7. 요소 wo RD 위치
  8. 빠른 요소 구절은 "
  9. 세 문자 검색
  10. 빠른 요소 문자 검색
  11. 는 또한 우리가 '필터링되지 않은를 사용하는 와일드 카드 검색을 후행
  12. 빠른 요소 후행 와일드 카드 검색

검색 옵션을 사용하십시오.

도움이 될 것입니다.

감사합니다.

답변

1

와일드 카드 색인 설정이 무엇인지 밝히지 않았습니다. 중요 : 색인에 올바른 정보가 포함되어 있지 않으면 결과가 예상과 다를 수 있습니다.

다양한 와일드 카드 색인이 작동하는 방식과 사용할 수있는 색인을 이해하려면 https://docs.marklogic.com/guide/search-dev/wildcard을 살펴보십시오. 이 경우 element-trailing-wildcard과 함께 trailing-wildcard을 제안 할 것입니다.

해당 쿼리는 일부 최적화 전략으로 개선 될 수도 있습니다. 가능하다면 element-value-query*으로 회피하고 싶습니다. 대신 cts:element-query($qname, cts:and-query(()))을 사용하십시오. 똑같은 일을하는 것이 훨씬 효율적입니다.

body이 간단한 요소 인 경우 element-queryword-query과 결합하는 대신 element-word-query을 사용하는 것이 더 효율적입니다. body이 복잡하면 (일치하는 텍스트가 하위 요소에있는 경우), 후행 와일드 카드 위치 인덱스가 활성화 된 요소 쿼리를 사용하거나 모든 하위 요소에 대해 element word query through을 설정하는 것 중에서 선택할 수 있습니다.

+0

세부 정보를 업데이트했습니다. 한번 봐주세요. –

+0

아마도 요소 쿼리에 단어 쿼리를 포함시키는 방식 때문일 것입니다. 후행 와일드 카드 위치 색인을 추가 할 수 있으며이를 수정할 수도 있지만 대신 쿼리를 최적화 할 수 있다면 더 좋습니다. – mblakele

+0

제안에 따라 쿼리를 다음 쿼리로 변경했습니다. cts : element-word-query (xs : QName ("body"), ("ace ??"), ("대소 문자를 구분하지 않음" 1) 나는 많은 단어를 가지고 있지만 쿼리는 어떤 결과도 가져 오지 않습니다. 검색어와 일치합니다. –