Commits

Devin Jeanpierre  committed 92a5eb8

initial commit

  • Participants

Comments (0)

Files changed (5)

File SolrTestProgram.sln

+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolrTestProgram", "SolrTestProgram\SolrTestProgram.csproj", "{E204EC20-AA22-4B77-9FA7-930CB68F5082}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{E204EC20-AA22-4B77-9FA7-930CB68F5082}.Debug|x86.ActiveCfg = Debug|x86
+		{E204EC20-AA22-4B77-9FA7-930CB68F5082}.Debug|x86.Build.0 = Debug|x86
+		{E204EC20-AA22-4B77-9FA7-930CB68F5082}.Release|x86.ActiveCfg = Release|x86
+		{E204EC20-AA22-4B77-9FA7-930CB68F5082}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

File SolrTestProgram/Program.cs

+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Practices.ServiceLocation;
+using SolrNet;
+using SolrNet.Attributes;
+using System.Web;
+
+// See for reference http://code.google.com/p/solrnet/
+// This code works with Solr.NET 0.4 beta 2.
+namespace SolrTestProgram
+{
+    public class Product
+    {
+        [SolrUniqueKey("id")]
+        public string Id { get; set; }
+
+        [SolrField("manu_exact")]
+        public string Manufacturer { get; set; }
+
+        [SolrField("cat")]
+        public ICollection<string> Categories { get; set; }
+
+        [SolrField("price")]
+        public decimal Price { get; set; }
+
+        [SolrField("inStock")]
+        public bool InStock { get; set; }
+    }
+
+    class Program
+    {
+        static void Main()
+        {
+            // was at one point args, too lazy to change
+            RunProgram("42", "MegaCorp Inc.", "399", "false", "new things");
+        }
+
+        public static void RunProgram(string id, string manufacturer, string price, string inStock, string category)
+        {
+            Startup.Init<Product>("http://search01.test.invup.com:8080/solr/localTestCore");
+            AddProduct(id, manufacturer, int.Parse(price), bool.Parse(inStock), category);
+
+            var p = GetProductById(id);
+            Console.WriteLine(string.Format("{0}: ({1}) ${2} in-stock:{3} [{4}]", id, manufacturer, price, inStock, category));
+            Console.ReadKey();
+        }
+
+        public static void AddProduct(string id, string manufacturer, int price, bool inStock, string category)
+        {
+            var p = new Product {
+                Id = id,
+                Manufacturer = manufacturer,
+                Categories = new[] {
+                    category
+                },
+                Price = price,
+                InStock = inStock,
+            };
+
+            var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Product>>();
+            solr.Add(p);
+            solr.Commit();
+        }
+
+        public static Product GetProductById(string id)
+        {
+            var solr = ServiceLocator.Current.GetInstance<ISolrOperations<Product>>();
+            var results = solr.Query(new SolrQueryByField("id", id));
+            if (results.Count != 1)
+                throw new Exception("solr count is wrong why why why");
+
+            return results[0];
+
+        }
+    }
+}

File SolrTestProgram/Properties/AssemblyInfo.cs

+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SolrTestProgram")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SolrTestProgram")]
+[assembly: AssemblyCopyright("Copyright ©  2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("307dac07-4833-4a27-813d-8f064720441a")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

File SolrTestProgram/SolrTestProgram.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{E204EC20-AA22-4B77-9FA7-930CB68F5082}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>SolrTestProgram</RootNamespace>
+    <AssemblyName>SolrTestProgram</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="AutofacContrib.SolrNet">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\unmerged\AutofacContrib.SolrNet.dll</HintPath>
+    </Reference>
+    <Reference Include="Castle.Facilities.SolrNetIntegration">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\unmerged\Castle.Facilities.SolrNetIntegration.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Practices.ServiceLocation">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\Microsoft.Practices.ServiceLocation.dll</HintPath>
+    </Reference>
+    <Reference Include="NHibernate.SolrNet">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\unmerged\NHibernate.SolrNet.dll</HintPath>
+    </Reference>
+    <Reference Include="Ninject.Integration.SolrNet">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\unmerged\Ninject.Integration.SolrNet.dll</HintPath>
+    </Reference>
+    <Reference Include="SolrNet">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\unmerged\SolrNet.dll</HintPath>
+    </Reference>
+    <Reference Include="StructureMap.SolrNetIntegration">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\unmerged\StructureMap.SolrNetIntegration.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Web.Services" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Unity.SolrNetIntegration">
+      <HintPath>..\..\..\..\..\local_programming\SolrNet-0.4.0.2002\unmerged\Unity.SolrNetIntegration.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

File SolrTestProgram/app.config

+<?xml version="1.0"?>
+<configuration>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
+  </startup>
+</configuration>