public static void Main(System.String[] args) { /* System.Runtime.Remoting.RemotingConfiguration.Configure("Lucene.Net.Search.RemoteSearchable.config"); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Http.HttpChannel(1099));*/ System.String indexName = null; if (args != null && args.Length == 1) indexName = args[0]; if (indexName == null) { System.Console.Out.WriteLine("Usage: Lucene.Net.search.RemoteSearchable <index>"); return ; } // create and install a security manager if (true) // if (System_Renamed.getSecurityManager() == null) // {{Aroush-1.4.3}} Do we need this line?! { // System_Renamed.setSecurityManager(new RMISecurityManager()); // {{Aroush-1.4.3}} Do we need this line?! } Lucene.Net.Search.Searchable local = new IndexSearcher(indexName); RemoteSearchable impl = new RemoteSearchable(local); // bind the implementation to "Searchable" System.Runtime.Remoting.RemotingServices.Marshal(impl, "tcp://localhost:1099/Searchable"); System.Console.ReadLine(); }
public static void Main(System.String[] args) { System.Runtime.Remoting.RemotingConfiguration.Configure("Lucene.Net.Search.RemoteSearchable.config"); System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Http.HttpChannel(1099)); System.String indexName = null; if (args != null && args.Length == 1) { indexName = args[0]; } if (indexName == null) { System.Console.Out.WriteLine("Usage: Lucene.Net.search.RemoteSearchable <index>"); return; } // create and install a security manager if (true) // if (System_Renamed.getSecurityManager() == null) // {{Aroush-1.4.3}} Do we need this line?! { // System_Renamed.setSecurityManager(new RMISecurityManager()); // {{Aroush-1.4.3}} Do we need this line?! } Lucene.Net.Search.Searchable local = new IndexSearcher(indexName); RemoteSearchable impl = new RemoteSearchable(local); // bind the implementation to "Searchable" System.Runtime.Remoting.RemotingServices.Marshal(impl, "tcp://localhost:1099/Searchable"); System.Console.ReadLine(); }
private void StartServer() { // construct an index Searcher local = FullIndex; // local.search (queryA, new Sort()); // publish it System.Runtime.Remoting.RemotingConfiguration reg = null; //// java.rmi.registry.LocateRegistry.CreateRegistry(1099); // {{Aroush}} RemoteSearchable impl = new RemoteSearchable(local); System.Runtime.Remoting.RemotingServices.Marshal(impl, ("http://localhost/SortedSearchable")); }
private static void StartServer() { // construct an index RAMDirectory indexStore = new RAMDirectory(); IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true); Document doc = new Document(); doc.Add(Field.Text("test", "test text")); writer.AddDocument(doc); writer.Optimize(); writer.Close(); // publish it //// LocateRegistry.CreateRegistry(1099); // {{Aroush}} Lucene.Net.Search.Searchable local = new IndexSearcher(indexStore); RemoteSearchable impl = new RemoteSearchable(local); System.Runtime.Remoting.RemotingServices.Marshal(impl, "http://localhost/Searchable"); }
private static void StartServer() { // construct an index RAMDirectory indexStore = new RAMDirectory(); IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true); Document doc = new Document(); doc.Add(Field.Text("test", "test text")); writer.AddDocument(doc); writer.Optimize(); writer.Close(); // publish it //// LocateRegistry.CreateRegistry(1099); // {{Aroush}} Lucene.Net.Search.Searchable local = new IndexSearcher(indexStore); RemoteSearchable impl = new RemoteSearchable(local); System.Runtime.Remoting.RemotingServices.Marshal(impl, "http://localhost/Searchable"); }
private void StartServer() { // construct an index Searcher local = FullIndex; // local.search (queryA, new Sort()); // publish it System.Runtime.Remoting.RemotingConfiguration reg = null; //// java.rmi.registry.LocateRegistry.CreateRegistry(1099); // {{Aroush}} RemoteSearchable impl = new RemoteSearchable(local); System.Runtime.Remoting.RemotingServices.Marshal(impl, ("http://localhost/SortedSearchable")); }
private static void StartServer() { if (serverStarted) { return; } // construct an index RAMDirectory indexStore = new RAMDirectory(); IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true); Document doc = new Document(); doc.Add(new Field("test", "test text", Field.Store.YES, Field.Index.TOKENIZED)); doc.Add(new Field("type", "A", Field.Store.YES, Field.Index.TOKENIZED)); doc.Add(new Field("other", "other test text", Field.Store.YES, Field.Index.TOKENIZED)); writer.AddDocument(doc); //Need a second document to search for doc = new Document(); doc.Add(new Field("test", "test text", Field.Store.YES, Field.Index.TOKENIZED)); doc.Add(new Field("type", "B", Field.Store.YES, Field.Index.TOKENIZED)); doc.Add(new Field("other", "other test text", Field.Store.YES, Field.Index.TOKENIZED)); writer.AddDocument(doc); writer.Optimize(); writer.Close(); try { System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(httpChannel, false); } catch (System.Net.Sockets.SocketException ex) { if (ex.ErrorCode == 10048) return; // EADDRINUSE? throw ex; } // publish it Lucene.Net.Search.Searchable local = new IndexSearcher(indexStore); RemoteSearchable impl = new RemoteSearchable(local); System.Runtime.Remoting.RemotingServices.Marshal(impl, "Searchable"); serverStarted = true; }
public void StartServer() { System.Runtime.Remoting.Channels.Http.HttpChannel httpChannel = null; while (httpChannel == null) { try { httpChannel = GetHttpChannel(); } catch (System.Net.Sockets.SocketException ex) { if (ex.ErrorCode != 10048) throw ex; } } try { System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(httpChannel, false); } catch (System.Net.Sockets.SocketException ex) { if (ex.ErrorCode == 10048) return; // EADDRINUSE? throw ex; } // construct an index Searcher local = GetFullIndex(); // local.search (queryA, new Sort()); // publish it RemoteSearchable impl = new RemoteSearchable(local); System.Runtime.Remoting.RemotingServices.Marshal(impl, "SortedSearchable"); serverStarted = true; }