开发者

Custom fields with sub-fields in Solr 1.4

开发者 https://www.devze.com 2023-02-09 16:24 出处:网络
does anyone know how to create a custom field in solr 1.4? I need to create a field containing sub values of the same type, say 3 strings.

does anyone know how to create a custom field in solr 1.4? I need to create a field containing sub values of the same type, say 3 strings.

The problem is abt something like this: suppose i want to declare in the schema an "image" 开发者_StackOverflowfield, which has 3 sub-fields (strings) like "path", "title", "thumb_path".

Any ideas?

I know in solr 1.5 there will be probably the concept of LatLon object, to contain the 2 values -doubles- of latitude and longitude. Have you seen something like that?

Luca


Sounds like you should consider creating an index of "image" documents in your SOLR index.

Each image "doc" would have the fields:

  • title
  • path
  • thumb_path
  • [gallery]

where [gallery] is a multi-value field (assuming images can appear in more than one gallery)

To construct a gallery page, you run the query "gallery:foo" and then iterate over the list of images, populating the HTML elements from the fields: title, path, etc.

Note: SOLR does not limit you to having a single document type in its index (whether its best practice is another matter). So you could also index other non-image documents as well. In this case its advisable to have a field like "doc_type" so you can limit searches to that type

0

精彩评论

暂无评论...
验证码 换一张
取 消