Issue Details (XML | Word | Printable)

Key: HSEARCH-213
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Hardy Ferentschik
Reporter: Emmanuel Bernard
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hibernate Search

Use FieldSelector and doc(int, fieldSelector) to only select the necessary fields

Created: 13/Jun/08 07:53 PM   Updated: 13/Nov/08 10:03 AM
Component/s: engine
Affects Version/s: None
Fix Version/s: 3.1.0.CR1

Time Tracking:
Not Specified

File Attachments: 1. Text File HSEARCH-213_vulnerable_to_custom_field_bridges.patch (11 kB)



 Description  « Hide
Not entirely what would be the impact as it defeats the Hits batch load (?)

 All   Comments   Work Log   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Emmanuel Bernard added a comment - 14/Jun/08 01:32 PM
The solution works great for simple cases, it loads only the necessary Fields of documents for a given query.

But a FieldBridge can add *any* field in a document (ie any name) so we cannot really filter by field name
(example composite PK field bridge do id.firstname, id.lastname)

Solution:

Add a new metadata to FieldBridge
FieldBridge.fieldNameStrategy() EXACT, IN_NAMESPACE, NON_SAFE


check the targeted Classes, to determine the less safe field bridge name strategy (including the embedded objects...)

If one of them is NON_SAFE => don't filter ;
if one of them is IN_NAMESPACE use a startWith FieldSelector
otherwise use EXACT

It seems to be a lot of effort for the benefit.

A downscale version is to use FieldSelector when no projection is used (entity load). We have to check id bridges but it probably worth it.

Thoughts?

Emmanuel Bernard added a comment - 14/Jun/08 01:33 PM
Attaching a patch: vulnerable to custom field bridges using TwoWayFieldBridge (not TwoWayStringBridge)