Tôi đang sử dụng Solr 3.6.1. Loại trường chính xác để sử dụng cho trường sắp xếp Solr có chứa các giá trị số nguyên là gì? Tôi chỉ cần trường này để sắp xếp và sẽ không bao giờ thực hiện các truy vấn trên đó. Tôi có nên sử dụng integer
hoặc sint
không?Solr fieldType chính xác để sử dụng cho việc sắp xếp các giá trị số nguyên là gì?
Tôi thấy rằng trong schema.xml, có sint
kiểu khai báo là:
<!-- Numeric field types that manipulate the value into
a string value that isn't human-readable in its internal form,
but with a lexicographic ordering the same as the numeric ordering,
so that range queries work correctly. -->
<fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
trong khi integer
nói như sau:
<!-- numeric field types that store and index the text
value verbatim (and hence don't support range queries, since the
lexicographic ordering isn't equal to the numeric ordering) -->
<fieldType name="integer" class="solr.IntField" omitNorms="true"/>
Lý do chính Tôi yêu cầu này là bởi vì mỗi Solr sắp xếp tôi làm trên một lĩnh vực sint
(Tôi có rất nhiều người trong số họ tuyên bố là lĩnh vực năng động) populates (unconfigurable) lucene fieldCache. Tôi thấy trên trang thống kê (http: // host: port/Solr/CORE/admin/stats.jsp) dưới fieldCache rằng sint
loại được lưu trữ như
org.apache.lucene.search.FieldCache$StringIndex
trong khi integer
loại được lưu trữ như
org.apache.lucene.search.FieldCache.DEFAULT_INT_PARSER
mà tôi tin là tiêu thụ ít không gian hơn?
UPDATE: Solr 3.6.1 schema.xml đã int
khai báo là TrieIntField
ví dụ như
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
Người ở trên là từ một phiên bản Solr cũ.
Bạn nên luôn sử dụng TrieIntField thay vì IntField và SortableIntField: lớp này có ** implent FieldCache hiệu quả hơn nhiều bộ nhớ ** – jpountz