The module should have a search component, like Flickr, search.creativecommons.org, Google Image Search, etc.

Comments

balleyne’s picture

hook_search() has been implemented by copying significant portions of code from node_search() and added a Creative Commons filter. Ideally, this filter option should just be part of the node_search()'s advanced search, but it's not clear to me how to accomplish that... it's really easy to add the additional fields, but it's not obvious how to add the filter into node_search, since the function explicitly checks for keys (of which CC is not one...).

This implementation ought to work in the meantime, but it should be integrated with node_search() (rather than duplicated) once we figure out how to do that...

turadg’s picture

Can you make a License facet for faceted search?

c-c-m’s picture

great!

toemaz’s picture

Version: master » 6.x-1.x-dev
Assigned: balleyne » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.12 KB

Find attached contrib module which implements 2 apachesolr hooks for the cc->name field. It will be available as a facet block.
Just coded, not tested at all, but I thought to throw it out there already.

toemaz’s picture

Title: Creative Commons Search » Contributed module: Creative Commons ApacheSolr facet

Changing title.

toemaz’s picture

Title: Contributed module: Creative Commons ApacheSolr facet » Integration of Creative Commons and Apache Solr
StatusFileSize
new1.26 KB

Previous implementation was not good since it hooked into CCK rather than implementing the right hooks. Copied over implementation from apachesolr_og and adapted.

toemaz’s picture

StatusFileSize
new8.96 KB

@balleyne

For the moment, I used the cc->name as facet field, but I have the feeling that this is not good. An alternative is to use the cc->license_uri which is also used by the core search implementation in the cc module. However, defining the facet value should not come from what data is available, but rather what you wish to display to the 'end' user.

When looking to the Flickr advanced search form, it is presented as followed:
screenshot

So, it might be good to use to use the same kind of solution for facets or perhaps even a combination of two facets:
- what one can do with it (end users) which is used for search, similar to http://www.flickr.com/search/advanced
- the real specific license which can be used for browse, similar to http://www.flickr.com/creativecommons

Any opinion?

turadg’s picture

Assigned: Unassigned » turadg
Status: Needs review » Fixed

I looked the code over and committed it. I don't have Solr set up to test it out but I successfully enabled it. I'm calling it Fixed for the 1.0 release. If it has bugs for people they can report them on new tickets.

toemaz’s picture

Status: Fixed » Needs work

Hola, I wouldn't commit it yet. It need much more work. Just leave it in the queue until someone picks it up and further extends it.

cfennell’s picture

StatusFileSize
new1.82 KB

I will just verify that @toemaz's module indexes and presents a cc facet as expected (fresh Drupal, apachesolr 1.x series, cc installs).

For fun and diversion, I am attaching an extended version that includes an apachesolr advanced search option to limit on cc licensed materials just as an example of how you might accomplish that w/apachesolr (it wasn't clear to me from the issue if the request was for apachesolr search, core search or both). Note: licensed/non-licensed was derived based on whether or not I saw a cc->url w/in the node object during indexing. Not knowing too much about the CC module, I can't say whether or not that is a reliable method to make this determination.

There are a quite a number of string fields that the cc module maintains, and it would be trivial to offer them as possible facets as @toemaz has done with the name field.

Good luck!

toemaz’s picture

Ok, time to get this module from under the dust.

Checking http://search.creativecommons.org gives a good idea on what the CC movement is considering the right search implementation. So we would need 3 search filters:
1. cc or not
2. use for commercial purposes
3. modify, adapt, or build upon

Indexing CC license with a bitfield is not done apparently.
Instead, we could store the on value like: CC BY SA
So to map it to the filters we need:
1. fq=licence:CC
2. fq=licence:(CC AND -NC)
3. fq=licence:(CC AND -ND)
2 & 3. fq=licence:(CC AND -ND AND -NC)

Does this make sense?

kreynen’s picture

In D7 I removed the Apache Solr submodule from the project since we're still dealing with issues in the core module update. Do you think it would make more sense to spin this off into it's own project?

turadg’s picture

Assigned: turadg » Unassigned

on other projects now, can't work on this anymore.

toemaz’s picture

I have coded what's explained in #11 and it seems to be working. What is left now is to make a form to expose the CC filter (as on search.creativecommons.org ) for advanced search and finally alter the apachesolr query. i'll attach it when ready.

Sure, I'll spin it off in it's own module.