IndexingSetup "Indexing a SemanticMediaWiki instance"

From FindAndLearn::Cookbook
C2016909305
Jump to: navigation, search


https://github.com/dataspects/FindAndLearnIndexerClasses

1 [email protected]:~$ tree
2 .
3 └── FindAndLearnIndexerClasses
4     └── findandlearn_wiki_indexer.rb
 1 # FindAndLearnIndexerClasses/findandlearn_wiki_indexer.rb
 2 
 3 module Dataspects
 4 
 5   class MediaWikiPage
 6     def hasEntityName
 7       "MY ENTITY NAME CUSTOMIZED AT INDEXING TIME"
 8     end
 9   end
10 
11   class FindAndLearnDocumentsIndexer < Indexer
12 
13     def initialize
14       super(dataspects_indexing_service_url: "https://indexing.dataspects.com")
15     end
16 
17     def execute
18       mediawiki = MediaWiki.new(
19         url: "https://cookbook.findandlearn.net/w",
20         user: "",
21         password: "",
22         log_in: :must_log_in
23       )
24       mediawiki.originatedFromResourceSiloLabel = "FindAndLearn Cookbook"
25       mediawiki.originatedFromResourceSiloID = "cookbook.findandlearn.net"
26       mediawiki.resources_from_CATEGORY("Entity") do |resource|
27         resource.entities.each do |entity|
28           @escluster.index(
29             body: entity.esdoc,
30             index: "my_index"
31           )
32         end
33       end
34     end
35 
36   end
37 end
38 
39 MediaWikiStandardIndexer.new.execute
1  [email protected]:~$ ruby FindAndLearnIndexerClasses/findandlearn_wiki_indexer.rb