Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
venshop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Nguyen Quoc Kien
venshop
Commits
f61f9e0b
Commit
f61f9e0b
authored
Aug 11, 2015
by
Nguyen Quoc Kien
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: rename Solr => SolrModule
parent
8caff564
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
lib/solr_module.rb
+25
-0
No files found.
lib/solr_module.rb
0 → 100644
View file @
f61f9e0b
class
SolrModule
def
initialize
@solr
=
RSolr
.
connect
:url
=>
Rails
.
configuration
.
solr_host
.
to_s
end
def
update_solr_index_after_import_product
(
id
,
name
)
%x{curl 'localhost:8080/solr/core0/update?commit=true' -H 'Content-type:application/json' -d '[{"id":"
#{
id
}
","name":{"set":"
#{
name
}
"}}]'}
end
def
delete_solr_index_after_delete_product
(
id
)
@solr
.
delete_by_id
id
@solr
.
commit
@solr
.
optimize
end
def
create_solr_index_after_create_product
(
id
,
name
,
price
,
description
)
doc
=
[{
:id
=>
id
,
:name
=>
name
,
:price
=>
price
,
:description
=>
description
}]
@solr
.
add
doc
@solr
.
commit
@solr
.
optimize
end
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment