Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a solr:create rake task #33

Closed
wants to merge 2 commits into from

Conversation

bertrama
Copy link

It looks like there aren't many good options for parsing arguments in rake.
This produces the cleanest command line invocation:

rake solr:create <directory> <name>

It looks like there aren't many good options for parsing arguments in rake.
This produces the cleanest command line invocation:

rake solr:create <directory> <name>
@bertrama
Copy link
Author

If preferred, I can change the task to use rake's native argument handling. i.e. invocation with:

prompt$ rake solr:create[directory, name]

@jcoyne
Copy link
Collaborator

jcoyne commented Mar 15, 2016

I would like to see this called solr:collection:create as solr:create sounds like what you'd do to create a server.

task(name.to_sym) {}
@solr_instance.create dir: directory, name: name
else
raise "Usage: rake solr:create <directory> <name>"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be an exception, it should just log to $stderr

@jcoyne
Copy link
Collaborator

jcoyne commented Mar 15, 2016

I don't understand why you'd want to do all this argument handling in rake when you have a binary script that is a lot more flexible at it.

@cbeer
Copy link
Owner

cbeer commented Mar 15, 2016

I wonder if we need to expose the path to the unpacked bin/solr command.

@bertrama
Copy link
Author

To explain my motivation, I was following along the Dive into Hydra guide, but every time I stopped and restarted solr, it would lose the data in the collection.

I also noticed that rake solr:start and rake solr:stop don't have the same behavior as solr_wrapper in regard to deleting the collection when it stopped, so it made sense to me to do a matching rake task.

Using bin/solr makes sense until I think about running two demos. Then have to remember and specify the port.

Invocation now looks like:

rake solr:collection:create <directory> <name>

Failing to specify a directory or name no longer raises an exception.
@jcoyne
Copy link
Collaborator

jcoyne commented Apr 12, 2016

every time I stopped and restarted solr, it would lose the data in the collection

@cbeer do you know how to make collections persistent in Solr 5/6?

@cbeer
Copy link
Owner

cbeer commented Apr 12, 2016

By design, it does not persist instance data. It might be possible to add configuration to disable that behavior, but we'd want to think hard about whether that's a good idea. In most cases where we're interested in persistence, I think we ought to encourage people to run solr directly.

Another alternative, if we want to support changing the solr collection configuration, is presented in #17.

@carolyncole
Copy link
Collaborator

@cbeer, @jcoyne: I know I did something very similar so I could could just run rake solr:start in development and not need to worry about losing the state of my solr instance all the time.

This PR comes close to allowing the user to run rake solr:start (like we used to run rake jetty:start) and you are up for development.

I was just about to put in a very similar PR when i realized this one already existed: https://github.com/cbeer/solr_wrapper/compare/master...psu-stewardship:solr_config?expand=1

@carolyncole
Copy link
Collaborator

@bertrama The new preference would be to use the executable. @cbeer included a new flag -preserve that keeps data from one run to the next. Can we close this PR?

In addition we changed the Active Fedora Generator to add this flag by default when the test app is generated in sufia. There is some documentation on running with the new configuration files here: https://github.com/projecthydra/sufia/wiki/Sufia-Development-Guide#work-with-test-app-in-the-browser

@bertrama
Copy link
Author

Yeah, that'll work for me, thanks!

@bertrama bertrama closed this May 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants