From: Demian K. <dem...@vi...> - 2014-01-08 14:38:18
|
Just to clarify and make sure we're on the same page - the current system allows you to create something like: (a AND b AND c) AND (d OR e OR f) AND (NOT g) But it doesn't let you do: (a AND b OR c) AND (d AND e OR f) OR (NOT g) That is, you get two levels of Boolean operators, but you can't mix and match at either level. This was a design decision - it seemed to offer quite a lot of flexibility while avoiding confusiong questions about operator precedence, etc. - essentially, the parentheses are in fixed positions. To solve the Primo issue I mentioned, I added the ability to include an operator within a Query as well as at the QueryGroup level - this offers more flexibility, but I'm not a big fan of it mainly because I think it makes things less clear.... So I guess the question is, does this explanation make you happier to work with the existing system, or would you prefer to incorporate the extensions? Obviously, one solution is easier than the other... but the "hard" part is mostly done, so it's just a matter of copying and pasting some code. - Demian From: Michelle Suranofsky [mailto:mi...@le...] Sent: Wednesday, January 08, 2014 9:18 AM To: Demian Katz Cc: vuf...@li... Subject: Re: [VuFind-Tech] question: multiple operators in QueryGroup I would like to allow for multiple top level operators...if I'm looking at things correctly -- it only has one top-level operator...and it is applied to each query: (q1 OPERATOR q2 OPERATOR q3 OPERATOR ...) AND (q4 OPERATOR q5 OPERATOR q6 ...) AND (q4 OPERATOR q5 OPERATOR q6 ...) AND (q4 OPERATOR q5 OPERATOR q6 ...) I would like to have something like this: (q1 OPERATOR q2 OPERATOR q3 OPERATOR ...) OR (q4 OPERATOR q5 OPERATOR q6 ...) AND (q4 OPERATOR q5 OPERATOR q6 ...) OR (q4 OPERATOR q5 OPERATOR q6 ...) thank you!! Michelle On Wed, Jan 8, 2014 at 9:03 AM, Demian Katz <dem...@vi...<mailto:dem...@vi...>> wrote: The default advanced search behavior should already allow two levels of Boolean operation - there's a top-level operator that is applied to the groups, and a group-level operator applied to the queries within the group. VuFind tries to conceal the Boolean nature of the functionality with more user-oriented language, but basically you construct queries of the form: (q1 OPERATOR q2 OPERATOR q3 OPERATOR ...) OPERATOR (q4 OPERATOR q5 OPERATOR q6 ...) ... ...if that makes any sense. The object is translated into the query through the QueryBuilder class within the backend. You can see some examples in the other VuFindSearch\Backend\*\QueryBuilder classes. If you need to make more extensive changes to the search model, let me know - I've been working with some Primo Central users to build a module for that discovery layer as well, and they need significantly different advanced search behavior; I was able to implement it fairly easily and that code might be useful for reference as well. You can find it in the primocentral branch of the main VuFind repo - still work in progress: https://github.com/vufind-org/vufind/tree/primocentral - Demian From: Michelle Suranofsky [mailto:mi...@le...<mailto:mi...@le...>] Sent: Wednesday, January 08, 2014 8:44 AM To: vuf...@li...<mailto:vuf...@li...> Subject: Re: [VuFind-Tech] question: multiple operators in QueryGroup Maybe I should clarify my question... I know how to change the class (to make operator a collection) -- but where do I have to make other changes in the code to deal with this change? How is the object translated into the query? I imagine I'll have to make changes there? thanks again! On Tue, Jan 7, 2014 at 2:16 PM, Michelle Suranofsky <mi...@le...<mailto:mi...@le...>> wrote: Hello, I would like to and/or/not the queries within a QueryGroup. At this time it looks like it has just one operator. Some of the files I'm looking at are: VuFindSearch\Query\QueryGroup.php VuFind\Search\QueryAdapter Any information about is appreciated!! thank you! Michelle |