Coder Social home page Coder Social logo

tadodotcom / grails-quick-search Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 9.0 396 KB

Grails plugin for quick search implementation. Supports search for domain class properties and adds utility functions and tag libraries for autocomplete functionality.

License: Other

Groovy 100.00%

grails-quick-search's People

Contributors

acrive82 avatar arunan-interlink avatar burtbeckwith avatar dfrommi avatar kuceram avatar macrosak avatar menilub avatar olivierkamers avatar zacharyklein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grails-quick-search's Issues

Sort on multiple fields

Is it possible to sort on multiple fields (firstName and lastName) so that "aa bb" comes before "aa cc" ?

Thanks a lot!

Allow for more complex searches

If I have a model with a User object like this:

class User {
    String firstName
    String lastName
}

and I want to be able to search for users called John Smith (firstName=John lastName=Smith), it would be cool if I could express that query using quick search. At the moment if I search for the string - John Smith, I retrieve all users with John in any field and all users with Smith in any field. I think in a lot of real world scenarios (especially those with complex models and large data sets), it quickly becomes hard to find what you're looking for.

Perhaps a good way to do it would be to assume that for any search term in quotes (e.g. "John Smith"), the tokens should be 'anded' together rather than 'ored'.

Example app

Would be really great to have a small example app

Can not specify just a sort column on H2

Specifying a sort column without it in the distinct columns causes H2 to fail as it will not sort on a column not in the results.

Setting the sort column as a distinct column in the query would be wrong as that would return the list of distinct values rather than the sorted domain objects.

customCriteria closure has no aliases

If I try to use the customCriteria:

def customCriteria = { println it }

It prints an empty list: []

Is this a bug or am I using it wrong?

All code:

def searchParams = [sort: 'firstName', order: 'asc', max: MAX_SEARCH_RESULT, offset: offset * MAX_SEARCH_RESULT]
def searchProperties = [firstName: "firstName", lastName: "lastName"]
def customCriteria = { println it }
PagedResultList userList = (PagedResultList) quickSearchService.search(domainClass: User, searchParams: searchParams, searchProperties: searchProperties, query: query, customCriteria: customCriteria)

In a debugging attempt we found that the code is always going into this if: https://github.com/tadodotcom/grails-quick-search/blob/master/grails-app/services/org/grails/plugins/quickSearch/QuickSearchService.groovy#L186

Thanks for your help!

CustomCriteria issue

Hi

I see that customCriteria closure doesn't work. Inspecting the code I found that key of settings map is wrong: customClosure instead customCriteria.

No examples in the doc?

Hi,

unfortunatly this probably great plugin has a very light documentation. An example how to use it would a lot more people try it out. Please consider to post an example of usage.

Best regards
-Bio

Total results count is incorrect

The totalCount property in QuickSearchService is incorrect - it is the total number of results with duplicates, whereas the results returned in the pagedResults collection has been filtered for duplicates.

This means that pagination is broken (the totalResults count is higher than the actual number of results returned).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.